Ask Your Question
0

how Could I get a parameter from the parameter server and use it in .yaml file.

asked 2019-02-16 05:48:58 -0500

MasterTsoutsos gravatar image

updated 2019-02-16 05:50:25 -0500

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.

edit retag flag offensive close merge delete

Comments

I worked around the problem by using seperate yaml flles after all. Thanks for the suggestion though!!

MasterTsoutsos gravatar imageMasterTsoutsos ( 2019-02-20 09:22:43 -0500 )edit

1 Answer

Sort by ยป oldest newest most voted
0

answered 2019-02-16 11:46:45 -0500

gvdhoorn gravatar image

I'm not sure this isn't an xy-problem, but using substitution args in yaml params is possible if you use a rosparam element with the subst_value set to true.

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower

Stats

Asked: 2019-02-16 05:48:58 -0500

Seen: 41 times

Last updated: Feb 16