elephantrobotics/pymycobot

ubuntu 22.04 sever on myagv_pi not work

cananella opened this issue · 1 comments

Describe the bug
I upload ubuntu 22.04 server on raspbarrypi sd card which in myagv
and pip install mypycobot, run simple test code
but code stuck when serial write
wheels don't turn
noting error occur

test code is

from pymycobot.myagv import MyAgv
import time

MA = MyAgv('/dev/ttyAMA0', 115200)

# forward
print("forward")
MA.go_ahead(40)
time.sleep(3)

# backward
print("backward")
MA.retreat(40)
time.sleep(3)

# turn left
MA.pan_left(40)
time.sleep(3)

# turn right
MA.pan_right(40)
time.sleep(3)

# clockwise
MA.clockwise_rotation(40)
time.sleep(3)

# counterclockwise
MA.counterclockwise_rotation(40)
time.sleep(3)

MA.stop()

and output is

ubuntu@ubuntu:~/test$ sudo python3 agv_test.py 
forward


when KeyboardInterrupt

^C Traceback (most recent call last):
  File "/home/ubuntu/test/agv_test.py", line 8, in <module>
    MA.go_ahead(40)
  File "/usr/local/lib/python3.10/dist-packages/pymycobot/myagv.py", line 218, in go_ahead
    self._mesg(128+go_speed, 128, 128)
  File "/usr/local/lib/python3.10/dist-packages/pymycobot/myagv.py", line 128, in _mesg
    self._write(command)
  File "/usr/local/lib/python3.10/dist-packages/pymycobot/myagv.py", line 37, in _write
    self._serial_port.write(command)
  File "/usr/lib/python3/dist-packages/serial/serialposix.py", line 640, in write
    abort, ready, _ = select.select([self.pipe_abort_write_r], [self.fd], [], None)
KeyboardInterrupt

how can i fix it?

Desktop (please complete the following information):

  • OS: ubuntu
  • Version 22.04 sever

Did you burn a Ubuntu 22.04 system yourself? If you are not using the official Elephant system, you need to configure a serial port to use it