Ask Your Question
0

How to use resource_retriever urls in command line yaml in launch script

asked 2012-08-09 10:06:20 -0500

baxelrod gravatar image

updated 2012-08-09 10:06:36 -0500

I am trying to display a mesh file in rviz by publishing a latched Marker message with "rostopic pub". This works, however, when I move this into a launch script, i get errors regarding the resource_retriever url. the launch script line:

<node name="$(anon robot_mesh_pub)" pkg="rostopic" type="rostopic" args="pub -l /robot_mesh visualization_msgs/Marker '{header: {frame_id: '/robot'}, type: 10, pose: {position: {x: 0, y: 0, z: 0.2}, orientation: {x: 0.5, y: 0.5, z: 0.5, w: 0.5}}, scale: {x: 0.001, y: 0.001, z: 0.001}, color: {r: 1.0, g: 1.0, b: 1.0, a: 1.0}, frame_locked: true, mesh_resource: package://meshes/robot.stl}'" output="screen"/>

I have tried to quote, and escape quote the "package://meshes/robot.stl" string in many different ways with no success. I think the problem is that the resource_retriever protocol "package:" looks just like the yaml dictionary key. (a string followed by a colon). and the roslaunch parser won't let me escape the quotes properly.

3 ideas:

  1. use the list format for command line yaml instead of dictionaries. (painful)

  2. the resource_retriever should have a feature to also accept "regular" file paths that start with a slash.

  3. this is possibly a bug in the roslaunch parser because it doesn't seem to handle escaped quotes properly.

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
1

answered 2012-08-14 10:06:56 -0500

jbohren gravatar image

updated 2012-08-14 10:10:36 -0500

None of the above! You're writing XML, so you need to escape quotes the XML way: "&quot;"

The following worked for me:

    <launch>
      <node 
        name="$(anon robot_mesh_pub)" pkg="rostopic" type="rostopic" 
        args="pub -l /visualiztion_markers visualization_msgs/Marker '{header: {frame_id: &quot;/world&quot;}, type: 10, pose: {position: {x: 0, y: 0, z: 0.2}, orientation: {x: 0.5, y: 0.5, z: 0.5, w: 0.5}}, scale: {x: 1.0, y: 1.0, z: 1.0}, color: {r: 1.0, g: 1.0, b: 1.0, a: 1.0}, frame_locked: true, mesh_resource: &quot;package://pr2_description/meshes/torso_v0/torso.stl&quot;}'" 
        output="screen"/>
    </launch>

Another solution, which will only work on your local machine is to use a "$(find package_name)" roslaunch macro. Also, the resource retriever can use "file://path/to/file" URIs.

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

Stats

Asked: 2012-08-09 10:06:20 -0500

Seen: 256 times

Last updated: Aug 14 '12