ros-controls / ros2_control

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

[Feature]: Get available states and commands interfaces from controllers. #1725

Open rafa-martin opened 3 months ago

rafa-martin commented 3 months ago

Situation:

In industrial robotics, motor drivers typically come equipped with one or more digital inputs and outputs. These I/O interfaces can be automatically detected by a "smart" HardwareInterface, which can then expose them via command and state interfaces (for digital outputs) or via state interfaces alone (for digital inputs) automatically by itself, without any config from ROS side.

Current Arquitecture:

robot_io_controller: ros__parameters: wheel_names:

Problem:

Proposed Solutions:

  1. Regex-Based Interface Configuration: Allow command_interface_configuration() and state_interface_configuration() to accept regular expressions. This would enable the automatic matching of interfaces, rather than relying on raw strings.
  2. Dynamic Interface Listing: Enable command_interface_configuration() and state_interface_configuration() to retrieve and list available commands or provide a callable method that returns this information dynamically during their invocation.

I would like to help in the project. Ideas are welcome.

mateusmenezes95 commented 3 months ago

I think that this will not solve your problem, but as I didn't see any mention in the issue description... Have you heard about the gpio tag?

rafa-martin commented 3 months ago

Yes, I heard about it, but probably I not explained the goal well.

From the example you provided, it's clear that the controller must be configured with the number of GPIOs defined in the robot's YAML file prior to launching the node, as demonstrated here: config. This setup does not support dynamic addition or removal of GPIOs based on the interfaces exposed by the loaded hardware interfaces.

The goal is to have a way to take all state interfaces:

The main challenge isn't about sharing GPIO data between a controller and a hardware_interface. Rather, it's about dynamically capturing all command_interfaces—which must already exist and are blocked when a controller accesses this shared resource. While it's currently possible for state_interfaces to be automatically captured by the controller_manager, enhancing this functionality with filtering capabilities would be ideal, wouldn't it?