def get_y(self): return(self.pos_y) def get_way(self): return(self.pos_way) def finish(self): self.__init__() #End class loc if __name__ == "__main__": from i2cDev import i2c_devices i2cDevs = i2c_devices() i2cDevs.start() i2cDevs.set_speed(20,20) MyLoc = loc() MyLoc.start() GPIO.setup(pinLeftA, GPIO.IN, pull_up_down=GPIO.PUD_UP) GPIO.setup(pinLeftB, GPIO.IN, pull_up_down=GPIO.PUD_UP) GPIO.setup(pinRightA, GPIO.IN, pull_up_down=GPIO.PUD_UP) GPIO.setup(pinRightB, GPIO.IN, pull_up_down=GPIO.PUD_UP) def test_kv(Motors): def test_value(value_pwm): i2cDevs.set_speed(value_pwm, value_pwm) sleep(0.01) t = time()
#!/usr/bin/python3.4 # -*-coding:utf-8 -* from constants import * import time from i2cDev import i2c_devices import localisation import automation as Z import sys import signal import math myI2cDev = i2c_devices() myI2cDev.save_gyro_offset(500) myLoc = localisation.loc() myI2cDev.start() myLoc.start() edit_file = False if edit_file: import os os.chdir("/home/pi/Documents/results") print ("File open at ",os.getcwd()) my_file = open(time.strftime("%B_%d_%H_%M_%S") + "txt", 'w' ) my_file.write("time(s)\tmpu6050\testimated_incl\tU_mot\tpos_way") time.sleep(0.2) # PI inclinaison, the value proposed are are the robust ones (half the limit ones) by 12V kva = 0.0 #30.0 kpa = 4000. #1000