ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question
1

Costmap and planner configuration from C++ code

asked 2021-01-26 14:31:42 -0500

bach gravatar image

Hi,

I need to fine tune the parameters of costmaps and planners in order to achieve good performance in navigation with move_base. Currently I modify directly the .yaml files (like costmap_common_params.yaml), but it is very tediuos.

So, is it possible to change the parameters directly from the C++ code and restart the simulation, without shutting down everything every time? In this way I could test different configurations easily and automatize the process maybe.

Thanks a lot.

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
3

answered 2021-01-27 00:59:49 -0500

mgruhler gravatar image

Many parameters in move_base as well as the costmaps can be configured using dynamic_reconfigure. I cannot guarantee that all you need are there, but most should be.

You can use the rqt_reconfigure (wiki) for a GUI solution to changing the parameter on the fly. Or you need to implement a dynamic_reconfigure_client in C++ (pretty much undocumented), wherever you need it.

edit flag offensive delete link more

Comments

SIncerly I did not understand very well the tutorial. But it stimulate me further search and I come out with this solution that seems working.

dynamic_reconfigure::ReconfigureRequest srv_req;
dynamic_reconfigure::ReconfigureResponse srv_resp;
dynamic_reconfigure::DoubleParameter double_param;
dynamic_reconfigure::Config conf;
double_param.name = par_name;
double_param.value = value;
conf.doubles.push_back(double_param);
srv_req.config = conf;
ros::service::call(srv_name, srv_req, srv_resp);
ROS_INFO("%s CHANGED to %f ", par_name.c_str(), value);
bach gravatar image bach  ( 2021-01-30 03:28:12 -0500 )edit

Question Tools

2 followers

Stats

Asked: 2021-01-26 14:31:42 -0500

Seen: 209 times

Last updated: Jan 27 '21