Access `robot_description` from `ros2_control` hardware

asked 2022-04-01 11:08:19 -0500

mcbed gravatar image

Hello,

I am currently working on a ros2_control hardware that can be dynamically set up and assembled using module as plugin components. Is there a way to get access to the robot_description from inside the hardware interface in on_configure()? I would like to describe my hardware like this

<hardware>
  <plugin>driver/Driver</plugin>
    <module>
      <plugin>plugin/Module1</plugin>
    </module>
    <module>
       <plugin>plugin/Module2</plugin>
    </module>
</hardware>

Is this possible ? If not should I rather pass the modules as parameters like this

<hardware>
   <plugin>driver/Driver</plugin>
   <param name="module_list">"[module1, module2]"</param>
</hardware>

Thanks!

edit retag flag offensive close merge delete

Comments

per my understanding, the controller_manager is just reading the robot_description from the robot_state_publisher node that's expected to be running. I don't see any reason why you couldn't also get this parameter directly in the same fashion

shonigmann gravatar image shonigmann  ( 2022-04-01 11:55:11 -0500 )edit

for me it is getting the parameter passed from the launch file directly without the need of launching the robot_state_publisher, but you are right that it can be a solution. The point is that this data should be already somewhere inside so is it possible to get it directly without the need of listening to the topic?

mcbed gravatar image mcbed  ( 2022-04-01 12:16:56 -0500 )edit

the robot_description is only used to initialize the resource_manager_which is stored with private access, and I am not aware of any existing interfaces to access it directly through the "hardware_interface" classes. But if you don't need the raw robot_description urdf output, then perhaps you can look at the accessor methods provided by resource_manager. There are public methods available to list actuators, sensors etc. But I don't think ros2_control, by default, stores any awareness of the geometry, etc

shonigmann gravatar image shonigmann  ( 2022-04-01 12:27:09 -0500 )edit