How can I change costmap footprint dynamically?

asked 2020-04-02 10:50:32 -0600

EdwardNur gravatar image

I am trying to change the costmap footprint via my cpp node:

 std::string footprint_string = "[[1.5, 1.5], [1.5, -1.5], [-1.5, -1.5], [-1.5, 1.5]]";

    // Changing params for the local/global costmaps:
    dynamic_reconfigure::ReconfigureRequest srv_req;
    dynamic_reconfigure::ReconfigureResponse srv_resp;
    dynamic_reconfigure::StrParameter str_param;
    dynamic_reconfigure::Config config;

    str_param.name = "/move_base_node/local_costmap/footprint";
    str_param.value = footprint_string;
    config.strs.push_back(str_param);

    srv_req.config = config;
    if (ros::service::call("/move_base_node/local_costmap/set_parameters", srv_req, srv_resp))
    {
        ROS_INFO("Calibrate::CalibrateCallback: Successfully changed the footprint for local costmap");
    }
    else
    {
        ROS_ERROR("Calibrate::CalibrateCallback: Could not change the footprint for local costmap");
    }

However, it says:

[FATAL] [1585838266.011619234, 9.300000000]: The footprint must be specified as list of lists on the parameter server, new_footprint was specified as [[1.5, 1.5], [1.5, -1.5], [-1.5, -1.5], [-1.5, 1.5]]
terminate called after throwing an instance of 'std::runtime_error'
  what():  The footprint must be specified as list of lists on the parameter server with at least 3 points eg: [[x1, y1], [x2, y2], ..., [xn, yn]]
[ERROR] [1585838266.181539612, 9.500000000]: Calibrate::CalibrateCallback: Could not change the footprint for local costmap
[ERROR] [1585838266.182272993, 9.500000000]: Calibrate::CalibrateCallback: Could not change the footprint for global costmap

I also see that my request does not go through the costmap ReconfigureCB. What am I doing wrong?

edit retag flag offensive close merge delete

Comments

Did you ever solve this?

Roberto Z. gravatar image Roberto Z.  ( 2022-05-05 05:50:55 -0600 )edit

I did it this way here, seemed to work ok, a bit hacky but there doesn't appear to be a proper documented way that I can find.

Zonared gravatar image Zonared  ( 2023-06-01 16:23:27 -0600 )edit