def connect(self, port_name='/dev/ttyACM0', baud_rate=9600):
self.serial_connection = None
try:
self.serial_connection = serial.Serial(
port=port_name,
baudrate=baud_rate
)
except serial.SerialException as e:
print "Could not connect", e
time.sleep(2) # no idea why but robot does not move if speed commands are sent
# directly after opening serial
while self.current_status is None:
print "Waiting for status message"
time.sleep(1)
print "received first status message with position", self.current_status.position
评论列表
文章目录