Dynamixel first uses

We’d like to test Pypot with Dynamixel in order to learn how to make a Poppy at la cité des sciences et de l’industrie on march 22 and 23.

I start with just on Dynamixel AX-12. It works.
But with two AX-12, I received an error in the scan.

The python program is :

import pypot
import pypot.dynamixel
print(pypot.dynamixel.get_available_ports())
dxl_io = pypot.dynamixel.DxlIO('COM9')
print(dxl_io.scan())

and the result:

['COM3', 'COM5', 'COM4', 'COM9']
Traceback (most recent call last):
  File "D:\Dossiers\th_perso\Poppy\Examples\ex01.py", line 9, in <module>
    print(dxl_io.scan())
  File "C:\Python33\lib\site-packages\pypot-1.5.2-py3.3.egg\pypot\dynamixel\io.py", line 207, in scan
    return [id for id in ids if self.ping(id)]
  File "C:\Python33\lib\site-packages\pypot-1.5.2-py3.3.egg\pypot\dynamixel\io.py", line 207, in <listcomp>
    return [id for id in ids if self.ping(id)]
  File "C:\Python33\lib\site-packages\pypot-1.5.2-py3.3.egg\pypot\dynamixel\io.py", line 200, in ping
    self._send_packet(pp, error_handler=None)
  File "C:\Python33\lib\site-packages\pypot-1.5.2-py3.3.egg\pypot\dynamixel\io.py", line 528, in _send_packet
    return self.__real_send(instruction_packet, wait_for_status_packet, _force_lock)
  File "C:\Python33\lib\site-packages\pypot-1.5.2-py3.3.egg\pypot\dynamixel\io.py", line 513, in __real_send
    msg = 'could not parse received data {}'.format(list(map(ord, data)))
TypeError: ord() expected string of length 1, but int found

What is wrong ?

Thank you

It seems to be a compatibility issue with pypot and python 3.3, @Pierre will check it.

By the way, how did you install your pypot library ? Did you clone the git repository or did you install it using pip ?

Hi @tdasse,

I have been away today and could not find time to test to reproduce your bug with a similar setup.
Yet, by looking at the error message, it seems that you have received a corrupt dynamixel package when scanning your motors. (Actually, it crashes when trying to raise a DxlCommunicationError, I will make a bug fix for this as soon as possible.)

Receiving corrupt messages usually indicates that one of the motor is broken. Just to make sure, can you try to ping each of your two motors individually? You can also try to scan two other motors. Let me know the result!

Some updates:

  • First, thanks for reporting the bug with the DxlCommunicationError with Python 3. I’ve committed the bug fix, if you pull the repo, it should work now (see https://github.com/poppy-project/pypot/pull/19 for details).

  • Second, I think your problem may be due to the fact that both motors have the same id. A really simple test to do is to connect each motor alone on the bus, scan them and check their id. If this is in fact your problem, you can change motors ids directly with pypot, use the herborist tool, or use the dynamixel wizard.

Hi @Pierre and @Matthieu,

Thank you for your advices.
The problem was both motors had the same id. I changed with Pypot and the scan is ok on Python 2.7 and Python 3.3 without the bug fix.

Thank you very much.
I continue my tests
Have a nice day.

Thierry

1 Like