Pass parameters to xacro from launch file, or otherwise
Is there an example anywhere of how to actually pass a value from a launch file to the xacro files? I found a number of things here and there, but nothing clear as to what you need to do in the launch file and then how to get and use the value in the xacro. I'm just trying to spawn two robots in a single world with a couple different parameters.
I'm using kinetic. I've examined these bits of documentation but I can't figure out how to weave them together. I've experimented with enough that it would be clutter to include.
http://wiki.ros.org/roslaunch/XML#sub...
http://wiki.ros.org/roslaunch/XML/arg
Here is what I have right now.
robot.xacro
...
<!--<xacro:property name="ctopic" value="/mybot/property/cmd_vel" />-->
<xacro:property name="ctopic" value="$(arg argCTopic)" />
<xacro:include filename="$(find mybot_description)/urdf/robot.gazebo" />
...
robot.gazebo
...
<gazebo>
<plugin name="differential_drive_controller" filename="libgazebo_ros_diff_drive.so">
<legacyMode>false</legacyMode>
<alwaysOn>true</alwaysOn>
<updateRate>100</updateRate>
<leftJoint>left_wheel_hinge</leftJoint>
<rightJoint>right_wheel_hinge</rightJoint>
<wheelSeparation>${chassisWidth+wheelWidth}</wheelSeparation>
<wheelDiameter>${2*wheelRadius}</wheelDiameter>
<torque>20</torque>
<!--<commandTopic>mybot/cmd_vel</commandTopic>-->
<commandTopic>${ctopic}</commandTopic>
<odometryTopic>mybot/odom_diffdrive</odometryTopic>
<odometryFrame>odom</odometryFrame>
<robotBaseFrame>footprint</robotBaseFrame>
</plugin>
</gazebo>
...
robot.launch
...
<!-- Load the URDF into the ROS Parameter Server -->
<param name="robot_description"
command="$(find xacro)/xacro.py '$(find mybot_description)/urdf/robot.xacro' argCTopic:=/mybot/one/cmd_vel" />
<!-- Run a python script to the send a service call to gazebo_ros to spawn a URDF robot -->
<node name="urdf_spawner" pkg="gazebo_ros" type="spawn_model" respawn="false" output="screen"
args="-urdf -model mybot -param robot_description"/>
...
Thanks