Use OpenCM9.04 as a USB2Dynamixel?

software
Tags: #<Tag:0x00007fc8f1a530e0>

#1

I’m an happy owner of a Darwin Mini since this week end.
After building it and tested it with original firmware, I’m back on my purpose : do something with XL320 and poppy project :wink:

First thing I wanted to check is the ability to use the OpenCm9.04 as a USB2Dynamixel.
From the code posted on Github, that looks possible.

As I’m sure others here have XL320 and OpenCM, I wonder if I miss an important technical blocker or not.


[CFC] Make a Creature with the Darwin Mini humanoid robot using a Raspberry Pi
Informations about the OpenCM9.04 board and Pypot
#2

Hey,

It is technically possible and I think there is an example sketch of it named “tosser firmware” or something like that.
However last time I tried to do that (october 2015) the performances were between bad (slow) and abysmal (lost characters), depending on the baudrate and communication volume.
In theory it could even be possible to make it into a USB2AX (with the additional advanced commands) but I haven’t tried it… The USB stack are different and adapting the code might need some work.


#3

that’s exactly the code I’m trying to implement.

But first, I had to have an easy way to access the usb port without loosing the cuteness of Darwin.
I think I got something cool this week end :wink:
20 new photos · Album by Thierry Chantier

Now, I will try the code part of course.
In my searches, I also found that it was going to be slow.
I want to see how slow it is.
But I’m aware of troubles and some possible improvements were suggested :slight_smile:http://forums.trossenrobotics.com/showthread.php?6741-OpenCM9-04-USB-Serial-Tosser-Help

I’ll see…


#4

You should take a look at this library(dynamixel v1 protocol only), which claim to improve performances of USBserial of the OpenCM9.04.


#5

It looks interesting but I know where my limits are at the moment.
I will start with simple tosser code, then try something as in the thread I mentioned.
Then… I’ll pray for the release of the Hipi board :wink:


#6

SO, at least I had time to try simple piece of code.
I’m able to retrieve position of servos for example.
For now, I didn’t find a document describing the protocol used on Dynamixel.
Do I have to guess through existing code or is there a central point of information on Dynamixel procotols ?

Edit: and the light show up!
http://support.robotis.com/en/product/dynamixel/xl-320/xl-320.htm
http://support.robotis.com/en/product/dynamixel_pro/communication/instruction_status_packet.htm


#7

Mince, sous OSX ce soir, lorsque je tente un import de pypot.dynamixel, j’ai droit à une chouette erreur :

>>> import pypot
>>> import pypot.dynamixel
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/Users/TitiMoby/anaconda/lib/python2.7/site-packages/pypot-2.11.0rc3-py2.7.egg/pypot/dynamixel/__init__.py", line 9, in <module>
    from .io import DxlIO, Dxl320IO, DxlError
  File "/Users/TitiMoby/anaconda/lib/python2.7/site-packages/pypot-2.11.0rc3-py2.7.egg/pypot/dynamixel/io/__init__.py", line 1, in <module>
    from .io import DxlIO
  File "/Users/TitiMoby/anaconda/lib/python2.7/site-packages/pypot-2.11.0rc3-py2.7.egg/pypot/dynamixel/io/io.py", line 2, in <module>
    from .abstract_io import (AbstractDxlIO, _DxlControl,
  File "/Users/TitiMoby/anaconda/lib/python2.7/site-packages/pypot-2.11.0rc3-py2.7.egg/pypot/dynamixel/io/abstract_io.py", line 12, in <module>
    from ...robot.io import AbstractIO
  File "/Users/TitiMoby/anaconda/lib/python2.7/site-packages/pypot-2.11.0rc3-py2.7.egg/pypot/robot/__init__.py", line 2, in <module>
    from .config import from_config, from_json, use_dummy_robot
  File "/Users/TitiMoby/anaconda/lib/python2.7/site-packages/pypot-2.11.0rc3-py2.7.egg/pypot/robot/config.py", line 23, in <module>
    import pypot.dynamixel.syncloop
  File "/Users/TitiMoby/anaconda/lib/python2.7/site-packages/pypot-2.11.0rc3-py2.7.egg/pypot/dynamixel/syncloop.py", line 3, in <module>
    from .controller import (DxlController,
  File "/Users/TitiMoby/anaconda/lib/python2.7/site-packages/pypot-2.11.0rc3-py2.7.egg/pypot/dynamixel/controller.py", line 5, in <module>
    from .io import DxlError
ImportError: cannot import name DxlError

#8

j’ai tout désinstallé, je suis reparti à propre avec pyenv.
ça passe maintenant.
Il me reste à sniffer ce que j’envoie à ma OpenCM9.04 parce que visiblement, ça lit et ça réponds mais pas ce qu’attend pypot en retour.

dxl_io = pypot.dynamixel.Dxl320IO(ports[0])
>>> dxl_io.scan()
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "pypot/dynamixel/io/abstract_io.py", line 220, in scan
    return [id for id in ids if self.ping(id)]
  File "pypot/dynamixel/io/abstract_io.py", line 213, in ping
    self._send_packet(pp, error_handler=None)
  File "pypot/dynamixel/io/abstract_io.py", line 526, in _send_packet
    return self.__real_send(instruction_packet, wait_for_status_packet, _force_lock)
  File "pypot/dynamixel/io/abstract_io.py", line 494, in __real_send
    status_packet = self.__real_read(instruction_packet, _force_lock=True)
  File "pypot/dynamixel/io/abstract_io.py", line 516, in __real_read
    raise DxlCommunicationError(self, msg, instruction_packet)
pypot.dynamixel.io.abstract_io.DxlCommunicationError: could not parse received data read :  after sending DxlPingPacket(id=0)

#9

It was fixed a day after the bug was introduced (cf this PR).

Are you sure that you use
You can buy a cheap logic analyzer if you have no oscilloscope.


#10

At some point, electronic signal debug may be useful, but first, I need to be sure messages are received and answered properly.
Maybe I’ll send debug through BT module


#11

OpenCM has even less documentation than Pypot on serial protocol :wink:
As such, I didn’t find how to use BT as a serial channel and I don’t know how to understand what’s wrong when I try to scan motors.
I know several ways to put a TCP sniffer but nothings seems to exists with serial connections.


#12

even if I find a software debug solution, I will try to learn how to use logic analyzer.
In that case, what will you look for? just if there is a signal on data?


#13

There is a “DxlCommunicationError”, not a timeout, so there is an answer but it is bad formated. With an oscilloscope you can see the real query ans answer of the motor, which sometime gives interesting things.

If you want the output seen by the pypot ; you can add a logger here.


#14

I ordered the cheap analyzer and I will try the logger also.
The time I need to do all that and the Hipi board will be available :wink:


#15

I received the Hobby Components analyzer.
But this is a hard fight to get Sigrok installed on my OSX.
Do you use Sigrok yourself ?


#16

No, I didn’t use Sigrock. I used ScanaStudio, the soft of Iklogic.


#17

I tried also with my Linux laptop and Sigrok still isn’t compiled.
All I have is the sigrok-cli…

I’m a bit disapointed because I bought a cheap analyzer that I can’t easily use.
That’s my fault, next time I’ll digg myself the market before buying.


#18

You misunderstood me, I used ScanaStudio with the hobbycomponent logic analyser !
But, when I bough it, it was explained in the description to use ScanaStudio. I think that they changed their description for copyright issues. As sigrock support iklogic hardware. I think it is still an iklogic cheap clone.
However, for sigrock there are packages available for many distributions, why do you try to compile it ?


#19

If you have an arduino, you can use it as an oscillo, especially with a 0-5V signal. Slow down your baudrate at 9600 and record the signal on an analog pin A0. Send to your PC with serial and graph the signal with matplotlib.

le code arduino :

//la valeur lue sera comprise entre 0 et 1023
int T = 0;

void setup() {
  //on se contente de démarrer la liaison série
  Serial.begin(921600);
}

void loop() {
  //on mesure la tension du capteur sur la broche analogique 3
  T = analogRead(0);
  //on affiche la tension calculée
  Serial.print(T);
  Serial.print('|');
  //on attend une demi-seconde pour que l'affichage ne soit pas trop rapide
  //delay(500);
}

#20

@Theo it was not against anything you wrote. Just that I need to double check myself before buying things :wink:
I need to compile because the avaible package stop at sigrok-cli and no pulseview as UI.
Whatever, I’ll dig in that little software issue.

The thing is that the true disappointing part is the non documentation for Embedded C on OpenCM 9.04.
You have some of the doc, not everything at all. Serial for example is really partly documented.

All that is to wait a solution based on Raspberry and a hat. But I understand that Hipi is just under heavy design.

PS: do you use your Hobby analyzer as a Scanlogic 2 in Scanastudio ?