I would like to run ros
launch file using xml
or yaml
files as argument.
How can I correctly set the .launch file to have access to parameters inside a xml or yaml file passed as argument?
If I understood correctly, let me show an example of hopping that will do the work.
Let's say that you want to control your robot and you want to select between joystick and keyboard teleoperation.
You create an man_ctrl.launch file
<launch>
<arg name="control_mode" default="joy"/>
<include file="$(find ctrl)/launch/$(arg control_mode).launch"/>
</launch>
and you can use it like:
roslaunch ctrl man_ctrl.launch control_mode:=<joy/key>
this means that you have already in place the joy.launch and the key.launch, such as:
<launch>
<node name="joy_node" pkg="joy" type="joy_node"/>
<node name="joy_teleop" pkg="teleop_twist_joy" type="teleop_node" respawn="true" output="screen">
<param name="scale_linear" value="1.0"/>
<param name="scale_angular" value="1.0"/>
</node>
</launch>
and
<launch>
<node name="keyboard_teleop" pkg="teleop_twist_keyboard" type="teleop_twist_keyboard.py" respawn="true"
output="screen" launch-prefix="xterm -e" />/>
</launch>