ros-controls / ros2_control_demos

This repository aims at providing examples to illustrate ros2_control and ros2_controllers
https://control.ros.org
Apache License 2.0
367 stars 175 forks source link

Implementation Query - Example 14 (Actuator and Sensor Interface)? #490

Closed ImTheMan153 closed 2 months ago

ImTheMan153 commented 3 months ago

Hello, I have been working with Ros2 control for a very long time and it is wonderful. Now, I am trying to implement a z axis with stepper control. So I just need a trigger signal that sends true (int 1) to my arduino based on my system state from ros ecosystem and after the task is done my Microcontroller would send back true in another variable through serial. I have a custom serial interface already implemented so all I need to do is call two different functions from my comms file which is void sendRequest(triggersignal) and void readState(zaxisstate) and I update another feedback topic based (provided by ros2 control) on the information I get. I thought I could use actuator interface although read function wasn't there in the example, I tried adding it. It doesn't really work. Also when my stepper does the task it gets stuck in a while loop as the steps are passed to the driver. Does it block my serial interface? In this case, which example I should be looking for and what is the best method to implement this? Thank you.

christophfroehlich commented 3 months ago

You can see the difference of system_interface, actuator_interface, and sensor_interface here. You could try to implement both inside a system_interface like in example_4 or separate it into sensor and actuator as done in example_14.

christophfroehlich commented 2 months ago

Closing due to inactivity.