Use rosparam inside launch file as an arg being passed to a launch file
I am wondering if there is a way to load a rosparam from the param server, and use it as an arg to an included launch file. I am trying to get around defining a variable in the config.yaml file and as an arg inside a launch file. In my config.yaml I have the following:
ROBOT_1_INITIAL_POSITION_X: 2.0
ROBOT_1_INITIAL_POSITION_Y: 0.5
ROBOT_1_INITIAL_POSITION_YAW: 0.0
I would then like to substitute these params in a launch file instead of the following (initial_position_x, initial_position_y, initial_position_yaw):
<launch>
<arg name="laser_enabled" default="true"/>
<arg name="kinect_enabled" default="false"/>
<arg name="robot_1_namespace" default="/OFFSET_1"/>
<arg name="robot_1_initial_position_x" default="2.0"/>
<arg name="robot_1_initial_position_y" default="0.5"/>
<arg name="robot_1_initial_position_yaw" default="0.0"/>
<include file="$(find husky_gazebo)/launch/spawn_husky.launch">
<arg name="laser_enabled" value="$(arg laser_enabled)"/>
<arg name="kinect_enabled" value="$(arg kinect_enabled)"/>
<arg name="robot_namespace" value="$(arg robot_1_namespace)"/>
<arg name="initial_position_x" value="$(arg robot_1_initial_position_x)"/>
<arg name="initial_position_y" value="$(arg robot_1_initial_position_y)"/>
<arg name="initial_position_yaw" value="$(arg robot_1_initial_position_yaw)"/>
</include>
</launch>
For reference, spawn_husky.launch
uses the initial position when spawning the gazebo model:
<node name="spawn_husky_model" pkg="gazebo_ros" type="spawn_model"
args="-x $(arg initial_position_x)
-y $(arg initial_position_y)
-Y $(arg initial_position_yaw)
-unpause
-urdf
-param robot_description
-model $(arg robot_namespace)" />