0
$\begingroup$

Rosanswers logo

I'm trying to use YAML launch files for a Gazebo simulation project I'm working on, but it doesn't seem like there's a lot of documentation beyond the basics here.

I need to process a robot description xacro and pass that as a param to robot_state_publisher.

Does the YAML frontend support this?

Does someone know of an example in an existing package?

I should be able to RUN the xacro processing with an executable but it's not clear how I'd store and access the variable. (I could probably put it into an env var and then read the env var, but that seems like a roundabout way to

https://design.ros2.org/articles/roslaunch_xml.html#executable-tag

Here I'm linking to XML docs because there's not much on YAML that I can find, but it seems from other recent investigations like YAML and XML are almost exactly the same.


Originally posted by danzimmerman on ROS Answers with karma: 337 on 2023-03-27

Post score: 0

$\endgroup$

2 Answers 2

1
$\begingroup$

Rosanswers logo

In an xml launch file I was able to process my xacro via

<node pkg="robot_state_publisher" exec="robot_state_publisher"
        <param name='robot_description' type="str" value="$(command 'xacro $(find-pkg-share myrobot_description)/urdf/robot.urdf.xacro')"/>
</node>

Note that I added the following line to the data_files member in setup.py

(os.path.join('share', package_name, 'urdf'), glob(os.path.join('urdf', '*[urdf][xacro]*')))

This was a slightly different approach than stated in the urdf tutorial and allowed my description files to be copied to the shared directory within a urdf folder.


Originally posted by chives_onion with karma: 180 on 2023-06-13

This answer was NOT ACCEPTED on the original site

Post score: 1

$\endgroup$
0
$\begingroup$

Rosanswers logo

I found the answer here https://github.com/ros2/launch/issues/366#issuecomment-572750757

There is a $(command ...) substitution that can be processed into a value, like:

- let:
    name: "robot_description_content"
    value: "$(command '$(find-exec xacro) $(var robot_xacro) name:=ur ur_type:=ur5e')"

Ultimately the same as launch.substitutions.Command() in a Python launch file.


Originally posted by danzimmerman with karma: 337 on 2023-03-27

This answer was ACCEPTED on the original site

Post score: 1

$\endgroup$

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.