nicola-sysdesign / delta_servo

ROS package to control Delta ASDA-A2-E Servo Drives
3 stars 2 forks source link

is there the use of EtherCAT SOEM library? #1

Open KennyRAS opened 2 years ago

KennyRAS commented 2 years ago

Dear sir/dame,

i've briefly looked through your code. So that i can also understand how to control the ASDA-A2-E Servo Drives with ROS and you can correct me if i'm wrong, but i don't see any form of the open-source SOEM library being used.

You also made functions that should give you full control over the motor and i ask to you, how did you write ethercat messages (msg) that can also make the driver move.

I know that ethercat msg consists of a bit order that is sent one after the another (telegram/datagram) , but i'm not sure which bits/bytes that i have to change so the motor will move.

thank you for if you've read this msg :)

nicola-sysdesign commented 2 years ago

Hi, first of all I want to state that this was a simple experimental project on which I haven't worked for a couple of years now and I don't guarantee it's fully functional.

Anyway, regarding you first question the answer is yes, it's based on SOEM library as you can see in the list of package dependencies: https://github.com/nicola-sysdesign/delta_servo/blob/65edb127d6cfe168619c6981ccea4149ed282023/package.xml#L21

Regarding your second question, to serialize/deserialize bytes to send/receive them to/from the ethercat bus take a look at rxpdo.h and txpdo.h. Here I defined some structs that match the default PDOs you will find on the drive; operator >>/<< simply serialize/deserialize attributes to/from an output/input array.

Take a look to the update function to see how they are streamed on the ethercat bus: https://github.com/nicola-sysdesign/delta_servo/blob/65edb127d6cfe168619c6981ccea4149ed282023/include/delta_servo/asda/ethercat/master.h#L429-L447

Warning!!: Keep in mind that this is not a fully tested software and it can cause jerky motions or dangerus movements when connected to the real servo so be sure you know what you are doing when sending commands.

Anyway I hope I helped you to better understand how it works. Bye! :-)

KennyRAS commented 2 years ago

Thank you for reply. I really appreciate your help with me understanding the functions.

My goal in the end is to write something similar as how you did it, but then in ROS2. So, did you have a connection/communication with the driver and am I allowed to be inspired by your code for controlling the servo_driver?

I wasn't sure if SOEM could even be implemented as: <depend>soem</depend> and how my directory hierarchy would look like.

in this forum, you can find someone who made a ROS2 soem wrapper as a package and exported their library to different packages and that confused me why i should do it like that.

I was able to build it in ROS2, but couldn't test it yet.

again, thanks for the help. i really appreciate the time.