0
$\begingroup$

I have a xacro file that I used for a specific piece of hardware. I figured out how to store custom data structures within the gpio framework within ros2_control

example:

    <gpio name="motion_command_output">
        <param name="byteIndex">0</param>
        <param name="bitMask">0x01</param>
    </gpio>

This would get automatically loading into the associated plugin and the data was available in the hardwareinfo structure/map.

I want to use the same xacro file but in a regular lifecycle node. It seems that I can read and parse the file in the launch file with

    device_config = xacro.process_file(io_config_file_path)
    device_config_parsed = device_config.toprettyxml(indent='  ')

But there isn't really a way to load that into the parameters.

I have tried a bunch of different options and it blows up or nothing happens. Another option would be just to parse the file in the node with tinyxml2.

Any ideas?

Thanks

$\endgroup$

1 Answer 1

1
$\begingroup$

Have a look at the component parser used within the controller_manager of ros2_control. It should be possible to use that in your node.

$\endgroup$
4
  • $\begingroup$ That seems to be the answer but I am getting an odd. "invalid URDF passed in to robot parser" error I checked the source and this seems to be related to general XML parsing. I have tried really basic valid XML and they all give the same error. I guess I will try a test with tinyXML2 and see what is going on. $\endgroup$
    – Seth
    Feb 12 at 21:07
  • $\begingroup$ this seems to come directly from tinyXML2 here $\endgroup$ Feb 12 at 21:17
  • $\begingroup$ Yeah, I figured that one out. I was passing the path in, instead of the xml. man alive. Now I am getting a sigfault(-11) somewhere in the parse_control_resources_from_urdf because I am not catching any exceptions. $\endgroup$
    – Seth
    Feb 13 at 18:53
  • $\begingroup$ I took the plugin tag out and that seems to be what caused the segfault. It is working now. Thaks $\endgroup$
    – Seth
    Feb 13 at 19:16

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.