import time from roboclaw import Roboclaw # Windows comport name # rc = Roboclaw("COM9", 115200) # Linux comport name rc = Roboclaw("/dev/ttyACM0", 115200) rc.Open() address = 0x80 rc.ForwardMixed(address, 0) rc.TurnRightMixed(address, 0) while (1): rc.ForwardMixed(address, 32) time.sleep(2) rc.BackwardMixed(address, 32) time.sleep(2) rc.TurnRightMixed(address, 32) time.sleep(2) rc.TurnLeftMixed(address, 32) time.sleep(2) rc.ForwardMixed(address, 0) rc.TurnRightMixed(address, 32) time.sleep(2) rc.TurnLeftMixed(address, 32) time.sleep(2) rc.TurnRightMixed(address, 0) time.sleep(2)
ser0.write(b'G\r\n') ser1.write(b'G\r\n') ser2.write(b'G\r\n') ser3.write(b'G\r\n') print('Zero Point Cal Air') time.sleep(1) # RoboClaw Start up rc = Roboclaw("/dev/ttyACM0",115200) rc.Open() address = 0x80 rc.ForwardMixed(address, 0) rc.TurnRightMixed(address, 0) # IMU startup if not bno.begin(): raise RuntimeError('Failed to initialize BNO055! Is the sensor connected?') # Print system status and self test result. status, self_test, error = bno.get_system_status() print('System status: {0}'.format(status)) print('Self test result (0x0F is normal): 0x{0:02X}'.format(self_test)) # Print out an error if system status is in error mode. if status == 0x01: print('System error: {0}'.format(error))
import time from roboclaw import Roboclaw #Windows comport name #rc = Roboclaw("COM9",115200) #Linux comport name #rc = Roboclaw("/dev/ttyACM0",115200) rc = Roboclaw("/dev/serial0", 38400) rc.Open() address = 0x80 rc.ForwardMixed(address, 0) rc.TurnRightMixed(address, 0) while (1): rc.ForwardMixed(address, 60) time.sleep(2) rc.BackwardMixed(address, 60) time.sleep(2) rc.TurnRightMixed(address, 32) time.sleep(2) rc.TurnLeftMixed(address, 32) time.sleep(2) rc.ForwardMixed(address, 0) rc.TurnRightMixed(address, 32) time.sleep(2) rc.TurnLeftMixed(address, 32) time.sleep(2) rc.TurnRightMixed(address, 0) time.sleep(2)