Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Compatibility with DRS-0602 #3

Open
ckiw opened this issue Dec 19, 2021 · 6 comments
Open

Compatibility with DRS-0602 #3

ckiw opened this issue Dec 19, 2021 · 6 comments

Comments

@ckiw
Copy link

ckiw commented Dec 19, 2021

Hello,

Do you know if your lib is compatible with DRS-0602 type of servos even for simple commands ?

(I have one off them but I didn't get it to work for the moment)

Thanks, Alexis

@cesarvandevelde
Copy link
Owner

I took a quick look; the command set and the registers look very similar. I'd start by verifying the packet structure and the opcode values against the information from the datasheet. Also, it's best to start with a hardware serial port. Software serial is less stable at higher baud rates, iirc. A decent logic analyzer is worth its weight in gold for stuff like this...

@ckiw
Copy link
Author

ckiw commented Dec 22, 2021

Thanks a lot

I'm using a arduino mega so I tried with both Hard and Soft Serial.
It has previously been used and don't know the ID or the baudrate saved inside. It's a brain teaser.

Good idea for the logic analyzer ! (an espotek labrador, I don't know if it will be sufficent)
I give you infos if I get something so you can update the doc

Alexis

@cesarvandevelde
Copy link
Owner

Just about any logic analyzer should be fine, the UART bus is relatively low speed. It will tell you (1) if packets are being sent correctly and (2) if there's a response from the servo.

It's best to start by getting the STAT command to work. Other commands may not respond with an ACK if the ACK policy register has been modified:

Request Herkulex Servo status r(Status Error, Status Datail)
Always send reply to STAT Packet regardless of r(ACK Policy)

There are 8 possible values for baud rate and 253 possible servo IDs, so you could try to brute-force it...

@ckiw
Copy link
Author

ckiw commented Dec 27, 2021

Hello,

After many hours (and your precious help, stat cmd + logic analyser). I finaly succeeded

I made a connection error by linking tx to tx and rx to rx. I was solved quickly.

The real burden was for position. The 0602 can go from 10627 to 22129 (by default)
image
(opposed to 21 to 1002 for the 0101)
So any exemple fail (from the arduino libs), even to ones from the manual are wrong because they are copy-pasted from the 0101 doc. So I had only errors even by sending byte per byte the JOG commands from the manual. 🤷‍♂️
I tried to modify the bytes 8 and 9 and I got some mouvement. Finally I understood I needed bigger numbers and I realised why !

By using correct position values it worked like a charm, all the fonctions are the same. I'd like to add an exemple for 0602 in the lib examples

As far as I know, the only difference in the protocol is for the VOR fonction (velocity overide) page 41

Alexis

@cesarvandevelde
Copy link
Owner

That's great to hear! I'd be happy to merge your example for the 0602. I'm also open to improving the library to cover the entire Herkulex family, but that will require some thought. The following (potential) issues come to mind:

  • Is the registry map the same for 020x / 040x / 060x or are there incompatibilities?
  • What's a good way to abstract away the resolution differences? I'm leaning toward new getPositionDegrees() / setPositionDegrees() methods that handle conversion behind the scenes.
  • The velocity override feature seems to be supported in 040x and 060x, but not 020x.

@ckiw
Copy link
Author

ckiw commented Jan 26, 2022

Hello,

  • I compared the documentation between 0101/0201 and 0602 and there is no incompatibilities, there is reserved bits if the feature is not on the model
  • Maybe add a parameter like that :

HerkulexServo servo_a(herkulex_bus, 10, DRS-0602); HerkulexServo servo_b(herkulex_bus, 11, DRS-0101);

and then behind the scene make the conversion. The resolution for the 0602 is
image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants