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

Bulk/sync operations with Protocol2 #56

Open
Aneoshun opened this issue Mar 11, 2019 · 6 comments
Open

Bulk/sync operations with Protocol2 #56

Aneoshun opened this issue Mar 11, 2019 · 6 comments

Comments

@Aneoshun
Copy link
Member

Hi all,

I am using X-series XM430-350 for my new hexapod robot. Following what I did in the past, I want to update the positions of my motors in one go, using bulk/sync operations.
I see that it is not yet fully implemented in libdynamixel (it is for Protocol1, but not the 2), and I see as well that there are some current changes in this direction (a few recent commits in this direction, but mainly targeted to MX series).

My question is: What are your plans/timeline? How can I help/implement stuff without interfering? (Not sure I fully understand the structure of LibDynamixel, it seems that it changed a lot since the last time I had a look in this code).

@PedroDesRobots
Copy link
Contributor

Hello @Aneoshun,
Actually the libdynamixel is not yet fully implemented but we continue to upgrade it.

I'm working on using bulk/sync operations with protocol1 and 2 with all the servos but it 's not an easy part. For the moment, bulk/sync works only with MX models and protocol 1. I need to do more test and trials for protocol 2.
I will create a branch called "bulk/sync" for this update.

After some analysis on MX28, the bulk_read function increases the frequency communication significantly but the sync_write function decreases the frequency, it's better to use reg_write. If you want more information on my tests let me know.

@Aneoshun
Copy link
Member Author

Hi @PedroDesRobots
Thanks for your reply.

I am surprised to read that it decreases the frequency. I wish to control 18 XM430 servos (like in the resibot hexapod) and sending the position one-by-one via reg_write seems to be way too slow (in particular waiting for the status of each motor).
I am looking to use set_goal_positions, like I did in the past with protocol 1, but I had issues porting this to protocol2.

Please let me know if I can help you or tests things from my side.

Best,

@PedroDesRobots
Copy link
Contributor

Hello @Aneoshun,

I got some good news.
I have fully implemented bulk_read and sync_write for protocol 1 and 2.
I tested it on MX28 (protocol 1) and XM430W350 (protocol 2), it works well for me. So lets me know if it works well for you too, you can switch on the branch "dev" (where the update is done).
you can use "get_current_positions_XM" (bulk_read) and "set_goal_positions" (sync_write) in servo.hpp

example in utility.hpp :
std::make_shared<servos::Xm430W350>(0)->set_goal_positions<id_t, double>(ids, angles))
std::make_shared<servos::Xm430W350>(0)->get_current_positions_XM(ids)

If it works well, I will ask for a PR on the master branch.

Like I said before, sync_write decreases the frequency but it's clearly more synchronized than reg_write. It's a trade-off to find and it could probably change from a firmware version to another... Concerning our hexapod, I tried both reg_write (resulting freq 300 Hz) and sync_write (resulting freq 35 Hz....). I invited you to test both on your hexapod and compare.

Now, the resibot hexapod is able to reach a frequency around 300Hz with 18 MX28 servos (with 3MBauds and 0 latency_timer).

@Aneoshun
Copy link
Member Author

Awesome. I will check later this afternoon.

@Aneoshun
Copy link
Member Author

I just had a quick test on my hexapod, and it works like I expected. Thank you very much.

As the sync_read/write instructions are broadcasted, it disables the production of status packets if I am correct, therefore, I can go quite fast in term of frequency. (I tried up to 500hz, without seeing a difference in my robot's behavior).
What is the limiting aspect from your side?

@mrunaljsarvaiya
Copy link

Does there happen to be an implemented bulk read function for present current?

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

3 participants