ros / urdf

Repository for URDF parsing code
63 stars 41 forks source link

Difficult to remap paramter name passed to initParam #20

Open sloretz opened 6 years ago

sloretz commented 6 years ago

It can be difficult to remap the parameter name passed to initParam (usually robot_description). This may be due to the call to searchParam().

https://github.com/ros/urdf/blob/470729633ba0419735603a054fec0b5bbfe442f9/urdf/src/model.cpp#L96-L99

This appears to work

<?xml version="1.0"?>
<launch>
  <param name="robot_description" type="str" value="Dummy value to trick searchParam"/>

  <node pkg="robot_state_publisher" name="private_robot_state_pub" type="robot_state_publisher">
    <remap from="/robot_description" to="~/robot_description"/>
    <param name="~/robot_description" type="str" value="&lt;robot name=&quot;private_robot&quot;&gt;&lt;link name=&quot;private_link&quot;/&gt;&lt;/robot&gt;"/>
  </node>
</launch>

And these result in the following error

[ERROR] [1530889965.789570642]: Could not find parameter robot_description on parameter server

no dummy global parameter

<?xml version="1.0"?>
<launch>
  <node pkg="robot_state_publisher" name="private_robot_state_pub" type="robot_state_publisher">
    <remap from="/robot_description" to="~/robot_description"/>
    <param name="~/robot_description" type="str" value="&lt;robot name=&quot;private_robot&quot;&gt;&lt;link name=&quot;private_link&quot;/&gt;&lt;/robot&gt;"/>
  </node>
</launch>

dummy parameter, but non-FQN in remap rule

<?xml version="1.0"?>
<launch>
  <param name="robot_description" type="str" value="Dummy value to trick searchParam"/>

  <node pkg="robot_state_publisher" name="private_robot_state_pub" type="robot_state_publisher">
    <remap from="robot_description" to="~/robot_description"/>
    <param name="~/robot_description" type="str" value="&lt;robot name=&quot;private_robot&quot;&gt;&lt;link name=&quot;private_link&quot;/&gt;&lt;/robot&gt;"/>
  </node>
</launch>

Motivated by ros/robot_state_publisher#89