예제 #1
0
    def __init__(self):
        self.sensor_obj = rs.sensorRead(
        )  #can pass filter window size as an argument
        self.sensor_obj.initialization()
        print('Sensor initalized and calibrated')
        file_name_object = tfn.dateS(
            sys.argv[1] + ' hovering data_log on '
        )  #to sync the name of the video and the experiment
        file_name_object.forText()
        file_name = file_name_object.dateStamp()
        self.workbook = xlsxwriter.Workbook(file_name)
        self.worksheet = self.workbook.add_worksheet()

        self.worksheet.write(0, 0, 'Time(s)')
        self.worksheet.write(0, 1, 'Voltage(V)')
        self.worksheet.write(0, 2, 'Depth(cm)')
        self.worksheet.write(0, 3, 'Current(A)')

        self.current_depth = 0
        self.line = 0

        self.obj_act = act.actuator()
        self.obj_act.CDC(100)

        self.ser = serial.Serial(
            '/dev/ttyUSB0', 9600
        )  #ACM0 for UNo	#object for getting handle of serial communication
예제 #2
0
 def __init__(self): #initialize sensor for calib_depth and create objects of classes
     
     print('Keep the Ubot out of water')
     self.sensor_obj = rs.sensorRead() #can pass filter window size as an argument
     self.sensor_obj.initialization()
     print('Now the Ubot is ready to be waterborne')
     
     #self.dtname_obj = tfn.dateS('height on ')
     #self.pwmname_obj = tfn.dateS('PWM on ')
     #self.figname_obj = tfn.dateS('Plot on ')
     self.act_obj = act.actuator() #can pass frequency as an argument
     self.plt_obj = None
     
     #self.dtname_obj.forText()
     #self.pwmname_obj.forText()
     #self.figname_obj.forFig()
     
     self.ddname = ''
     self.dtname = ''  #the returned names will be stored in these variables
     self.pwmname = ''
     self.figname = ''
     
     self.Kp = 0.0001
     self.Kd = 0
     self.Ki = 0
     
     self.desired_depth = 0
     self.current_depth = 0
     self.pwm = 0
     self.t = 0
     self.dt = 0
     # both the flags should be zero for operation
     self.shutflag = 0
     self.writeflag = 0
    def __init__(
        self
    ):  #initialize sensor for calib_depth and create objects of classes

        print('Keep the Ubot out of water')
        self.sensor_obj = rs.sensorRead(
        )  #can pass filter window size as an argument
        self.sensor_obj.initialization()
        print('Now the Ubot is ready to be waterborne')

        #self.dtname_obj = tfn.dateS('height on ')
        #self.pwmname_obj = tfn.dateS('PWM on ')
        #self.figname_obj = tfn.dateS('Plot on ')
        self.act_obj = act.actuator()  #can pass frequency as an argument
        self.plt_obj = None

        #self.dtname_obj.forText()
        #self.pwmname_obj.forText()
        #self.figname_obj.forFig()

        self.ddname = ''  #desired depth
        self.dtname = ''  #the returned names will be stored in these variables
        self.pwmname = ''
        self.figname = ''
        self.velname = ''

        self.Kp = 0.05
        self.Kd = 0.05
        self.Ki = 0

        self.desired_depth = 0
        self.current_depth = 0
        self.pwm = 0
        self.t = 0
        self.dt = 0
        self.velocity = 0

        # both the flags should be zero for operation

        self.shutflag = 0
        self.writeflag = 0

        #self.threshold = 2.1972 #for making the bot neutrally buoyant i.e. at any depth it can hover

        #Experimentally determined values of PWM and corresponding power values
        self.power = [
            0, 3.6, 7.68, 10.92, 15.64, 19.19, 23.31, 27.14, 32, 34.58, 37.8
        ]
        self.pulse = [
            0, 32.1, 45.7, 55.7, 65.7, 72.1, 79.3, 84.3, 91.4, 95, 100
        ]
예제 #4
0
'''
'''
import liveMultiPlots as lmp
import threading

obj = lmp.plotLive('one.txt','two.txt','three.jpg')
        
t1 = threading.Thread(target = obj.action)
#t1.daemon =True
t1.start()
print("main thread ended")
'''

import actuation as act
import time

obj = act.actuator()
obj.Start(0)
time.sleep(1)
obj.CDC(0)
time.sleep(1)
obj.Stop()
obj.CleanUp()

'''
import time

print('I am going to sleep!')
time.sleep(0.25)
print('I woke up!')
'''