ROBOTIS-GIT / DynamixelSDK

ROBOTIS Dynamixel SDK (Protocol1.0/2.0)
http://emanual.robotis.com/docs/en/software/dynamixel/dynamixel_sdk/overview/
Apache License 2.0
443 stars 398 forks source link

Consider support for custom half-duplex converter circuit with GPIO #547

Open pdenes opened 2 years ago

pdenes commented 2 years ago

Hi, I'm trying to control Dynamixel servos with a Raspberry Pi. Due to size and other hardware constraints, using the USB port and U2D2 is not really possible. At first glance, it seemed that using the ttl serial UART and the half-duplex converter circuit documented in the manual would be an ideal solution.

I've seen several projects doing that with custom libraries, not using the SDK. But I'd really prefer to use this SDK with all the tools building on it (especially with ROS!) I've also come across #208 - it seems like the idea has been discarded, and I understand there might be limitations. But I think supporting this would be very useful for situations where people don't / can't use the U2D2 and accept lower speeds or maybe less reliable comms. Following the pointers in #208 to the Arduino code, I implemented a PoC using gpiod - and it seems to work perfectly well. Tested with XL-330 and a Pi Zero 2W (only with the default 57600 baud so far). The examples for dynamixel-workbench work fine, without any errors or timeouts.

It's only a few lines of change and can be made optional and compile-time only, so it wouldn't really affect anything/anyone not needing it - I'm not sure if this is the best approach, but here is my PoC: https://github.com/pdenes/DynamixelSDK/commit/8523aa822c78289dd1a59207008d90916b854443 (I can turn this into a proper PR if there is interest.)

ROBOTIS-Will commented 2 years ago

Hi @pdenes

Thanks for your suggestions and inputs. I believe there are a few Raspberry Pi Hat that supports DYNAMIXEL interface (TTL / RS485) and all of them requires direction control as you may have already experienced. Even in our official circuitry, it is recommended using the direction control pin so I think appending your gpio control option has a valid point at the moment.

Last year we had a closed beta test for DYNAMIXEL Hat (for Raspberry Pi), but didn't get through the release stage. If possible could you provide more details about your project so that I can compile RPi + DYNAMIXEL use cases?

Please feel free to PR your PoC :) Thanks!