analogdevicesinc / tmcl_ros2

Official ROS2 Driver for Trinamic Motor Controllers (TMC) that uses Trinamic Motion Control Language (TMCL) protocol
BSD 3-Clause "New" or "Revised" License
9 stars 0 forks source link

Using GIO, SIO commands #2

Open rishavbpm opened 2 months ago

rishavbpm commented 2 months ago

@CAcarADI @jmacagba @mmaralit-adi I am trying to use the set/get commands for the GPIO pins. Looks like there is no ros2 service to use them. When I try to use the custom command service, I get the following unsupported error. Please help, thanks!

ros2 service call /tmcm1/tmcl_custom_cmd adi_tmcl/srv/TmcCustomCmd "{instruction: 'GIO', instruction_type: 1, motor_num: 3, value: 1}"

image

CAcarADI commented 2 months ago

Hi @rishavbpm

May we know what exact module you are using?

To use the custom command service, the available instructions are "GAP", "SAP", "GGP" and "SGP" only. For the instruction_type, open the YAML of your module located in the config/autogenerated directory, and look for the "AP_type". Although manually checking this might be challenging, we have found it helpful to copy the YAML contents into a table format, with each parameter placed in a separate column.

For example, you want to get the value of Axis Parameter "Actual Position" of motor 0. Check the AP_type of "Actual Position":

A B
AP_name: [TargetPosition, AP_type: [0,
ActualPosition, 1,
TargetVelocity, 2,
ActualVelocity, 3,
... ...
... ...
... ...

Then on custom command service, call ros2 service call /tmcm1/tmcl_custom_cmd adi_tmcl/srv/TmcCustomCmd "{instruction: 'GAP', instruction_type: 1, motor_num: 0, value: }"