what is the correct way to change dynamic footprint?
Hello everyone, I am trying to change the shape of my polygon footprint dynamically from a cpp node and cant seem to find the correct way or a working example.
Some quick background, I have a center/centre steering articulated robot, which means the footprint changes with respect to articulation angle. I'm using TEB nav and move_base, TEB nav supports dynamic footprint but I cant find examples of how to use it.
If I use rqt_reconfigure (i.e. dynamic reconfigure) I can adjust the footprint string and can see it change in rviz. This is my footrpint:
base_local_planner_params.yaml
footprint_model:
type: "polygon"
vertices: [[0.681,-0.280],[0.356,-0.280],[0.166,-0.300],[-0.159,-0.300],[-0.166,0.300],[0.166,0.300],[0.356,0.280],[0.681,0.280]]
It appears you cant publishing to topic /move_base/local_costmap/footprint because its frame_id is odom, you also cant publish to move_base/global_costmap/footprint because its frame_id is map, you need to change the footprint of the robot, probably base_link frame or something.
I then tried to change the parameter footprint by writing to /move_base/local_costmap/footprint using rosparam. First if I use this command to read/get current parameter:
$rosparam get /move_base/local_costmap/footprint
'[[0.681,-0.28],[0.356,-0.28],[0.166,-0.3],[-0.159,-0.3],[-0.166,0.3],[0.166,0.3],[0.356,0.28],[0.681,0.28]]'
Then try to change the first point to [1.0,-0.28] using this command, I end up with a different looking string and the footprint doesn't change:
$rosparam set /move_base/local_costmap/footprint '[[1.0,-0.28],[0.356,-0.28],[0.166,-0.3],[-0.159,-0.3],[-0.166,0.3],[0.166,0.3],[0.356,0.28],[0.681,0.28]]'
- - 1.0
- -0.28
- - 0.356
- -0.28
- - 0.166
- -0.3
- - -0.159
- -0.3
- - -0.166
- 0.3
- - 0.166
- 0.3
- - 0.356
- 0.28
- - 0.681
- 0.28
I then tried writing to footprint parameter using cpp code like this:
std::string footprint_str;
footprint_str="[[0.681,-0.28],[0.356,-0.28],[0.166,-0.3],[-0.159,-0.3],[-0.166,0.3],[0.166,0.3],[0.356,0.28],[0.681,0.28]]";
ros::param::set("/move_base/local_costmap/footprint", footprint_str);
ROS_INFO("Footprint: %s",footprint_str.c_str());
This doesn't work either. Although if you read/get param footprint you can see cpp code has actually changed the param but rviz doesn't reflect it. After adjusting footprint via param when you echo /move_base_local/footprint is doesn't show the change, but if your running rtq_reconfigure it does show a change but not in rviz. But if you close and open rqt_reconfigure the footprint is unchanged.
Also lots of people are saying your not suppose to use param's for constantly changing variables, that's what topics are for. I've looked at all theses links:
Hi there, I'm still searching for the correct way to do this, cant find the answer. i found this link https://answers.ros.org/question/237365/dynamic-footprint-in-navigation/, the problem with publishing to the footprint topic is its frame ID is odom so the polygon coordinates are changing depending on robots position. And here how-can-i-change-costmap-footprint-dynamically Surely someone has required a dynamic footprint? Thanks again.