how Could I get a parameter from the parameter server and use it in .yaml file.
What I am trying to do is to install two turtlebots in GAZEBO in reference to this famous post and try to cover willow garage with them.
I managed to get AMCL running for both robots just fine. Now I need to set move base but I want obviously to set all the costmaps running for the namespace of each robot. So According to the code bellow I set the tf prefixes (robo1_tf/ , robot2_tf).
So what I have is one name space here and a tf_prefix:
<nav_file.launch>
<group ns="robot1">
<param name="tf_prefix" value="robot1_tf" />
<param name="amcl/initial_pose_x" value="-1.0" />
<param name="amcl/initial_pose_y" value="-1.0" />
<param name="amcl/initial_pose_a" value="0.0" />
<param name="global_frame_id" value="/map" />
<param name="amcl/odom_frame_id" value="robot1_tf/odom"/>
<param name="amcl/base_frame_id" value="robot1_tf/base_link"/>
<param name="map_topic" value="/map" />
<remap from="/scan" to="/robot1_tf/scan"/>
<remap from="static_map" to="/static_map"/>
<include file="$(find my_2d_nav)/launch/start_move_base2.launch" />
</group>
and one part of the common costmap.yaml file of move base is below
<common_costmap>
observation_sources: laser_scan_sensor
laser_scan_sensor: {sensor_frame: base_link, data_type: LaserScan, topic: scan, marking: true, clearing: true, expected_update_rate: 15.0}
so What I wanna do, instead of creating two seperate costmap files going along the line
common_costmap_params1.yaml
observation_sources: laser_scan_sensor
laser_scan_sensor: {sensor_frame: robot1_tf/base_link, data_type: LaserScan, topic: robot1/scan, marking: true, clearing: true, expected_update_rate: 15.0}
common_costmap_params2.yaml
observation_sources: laser_scan_sensor
laser_scan_sensor: {sensor_frame: robot2_tf/base_link, data_type: LaserScan, topic: robot2/scan, marking: true, clearing: true, expected_update_rate: 15.0}
I want to keep ONE common_costmap_params.yaml for BOTH namespaces like
observation_sources: laser_scan_sensor
laser_scan_sensor: {sensor_frame: $(tf_prefix)/base_link, data_type: LaserScan, topic: $(ns)/scan, marking: true,
clearing: true, expected_update_rate: 15.0}
if it was python code I Would do
prefix = rospy.get_param("tf_prefix")
But How do I do the above python trick in a yaml file? I do have read the Param Server docs but there sth I cannot gasp something in the Syntax I do not know. I thought that move_base would work out of the box for each ns but this does not seem to be the case
If you need any list of topics, nodes, tf_tree, node graph, let me know and I will update. If the question is not well stated I will update also. thanks for any direction or hint or link in advance.
I worked around the problem by using seperate yaml flles after all. Thanks for the suggestion though!!