ros-controls / ros2_control

Generic and simple controls framework for ROS 2
https://control.ros.org
Apache License 2.0
469 stars 285 forks source link

How to pass additional information to the hardware interface #1016

Open guidout opened 1 year ago

guidout commented 1 year ago

Background

Hi, I have posted a question on Stack Exchange about CAN messages and hardware interfaces but I think the question can be generalized.

My issue (maybe it's already possible but I'm not aware of how) is how to pass additional information to the hardware interface besides commands and states. In my use case, I have to interface with an existing vehicle CAN bus (so I can't change the messages' definitions) and the hardware interface will send steering and throttle commands to the existing vehicle module. Each CAN message has more information than just the command and/or the sensor. So I need a way to get that information down to the hardware interface so that it can generate a complete CAN message. This additional information could come either from a node or from a controller.

Is there an already existing mechanism to accomplish this?

Thank you in advance

swiz23 commented 1 year ago

This may be relevant. You can look at the Issue linked in the following PR https://github.com/ros-controls/ros2_control/pull/1012

Specifically, at least the way I intend to use that PR is as follows:

destogl commented 1 year ago

yes, please check how we have solved this in the ros2_canopen repository. There you can find ideas, the right amount of abstraction you have to do yourself.

@Xi-HHHM is just adding detailed docs about ros2_canopen, so this can also help you to understand the concepts - note that this description is subject to changes – we just want to structure this better.

Also note that I don't agree with @swiz23's solution as it can be solved much nicely.

mateusmenezes95 commented 7 months ago

This is an old issue, but for new people who are looking for a solution, an alternative to ros2_canopen could be the feature proposed in the PR https://github.com/ros-controls/ros2_control/pull/1240