ICube-Robotics / ethercat_driver_ros2

Hardware Interface for EtherCAT module integration with ros2_control
https://icube-robotics.github.io/ethercat_driver_ros2/
Apache License 2.0
126 stars 32 forks source link

Changing the output type of GenericEcSlave #65

Closed IdoPractical closed 1 year ago

IdoPractical commented 1 year ago

Hello, I successfully connected my Delta R1-EC6002 module to ROS2 via Ethercat. It's a digital input module with 16 channels, the output should be Boolean but I see it as Float. For example, I see 8.0 when I click the button connected to channel 4 (due the bit mask). I assume it happens because of the type of the gpio_states topic which is DynamicJointState Is there a way to change the data type of this topic? Thank you!

mcbed commented 1 year ago

Hi @practical-mechanics, If you want to have a boolean output topic, the best way is to create your specific controller that converts the state_interface double data to a boolean array message and publishes it on a ROS topic.

IdoPractical commented 1 year ago

Hi @practical-mechanics, If you want to have a boolean output topic, the best way is to create your specific controller that converts the state_interface double data to a boolean array message and publishes it on a ROS topic.

I didn't think about it.. good idea :) Is it possible to make it with a node instead of a controller? (sorry for the noob question) Do you have any information about how to create a controller on ROS2? Thank you!

mcbed commented 1 year ago

You can do it with a node by reading the topic and doing the conversion but a dedicated controller is more suited for this. For building controllers for ros2_control, here is a tutorial.

IdoPractical commented 1 year ago

Thank you!