# Set offset to local costmap and rotate with robot

Hi together,

I would like to know if there is a possibility to set an offset to the local costmap in general. The problem I am facing is, my local costmap is centered at my robots footprint, however the footprint is not centered at the actual robot it is more in the of the robot. Assuming I have a costmap of width and height of 15.0 it and my footprint of the robot is 1.5 meters off the center of the robot it causes the costmap to look way more in the back than in the front of the robot. It would be better for me if the costmap is about 2meters in the back and 13 meters (overall 15) meters in the front.

I already tried to use these parameters in the local_costmap_params.yaml

origin_x:
origin_y:


But it didn't change anything.

Is it somehow possible anyways?

Another question I got, is it possible to yaw the costmap with the robot, so it doesnt need to be square? Because as said before I mainly need the lookahead in the front of the robot, not too much to the sides and too much to the back.

edit retag close merge delete

costmap_2d has a parameter called robot_base_frame, I think there might be something wrong with this parameter. If the frame you set for this parameter is not the center of the footprint, well, the costmap won't be in the center of the footprint.

( 2016-07-15 02:20:55 -0600 )edit

Yes, I saw this parameter. But my base frame is actually not in the center of the robot (ackermann kinematics) and also my local planer uses this parameter for controlling the platform, so I cant change this.

( 2016-07-18 01:53:31 -0600 )edit

Sorry, I didn't understand what is the exact problem with setting the base frame in the center of the robot, especially the part that you said the ackermann kinematics. Can you please explain more?

( 2016-07-18 06:09:32 -0600 )edit

Hi, by setting the parameter robot_base_frame in the center, also my local planner takes this point for planning with the vehicle, but with ackermann kinematics this in not correct, because the center of rotation is at the rear axle and not in the center of the robot.

( 2016-07-25 03:16:55 -0600 )edit
1

Have you found any solution about the rotation of the costmap, so that it aligns with the robot orientation?

( 2021-03-01 11:42:52 -0600 )edit

I found a possible solution for the rotation of the costmap.

( 2021-07-21 04:53:40 -0600 )edit

Sort by » oldest newest most voted

Regarding the center of your local costmap, a quick solution would be to move your /base_link frame, which I suppose is currently in the center of the robot, towards the rear axle.

Another solution would be to create a new frame located at the rear axle and use it instead of the /base_link for your local_costmap.

more

I understand that you want to calculate odometry for Ackermann steering based on a frame that is centered between the rear wheels. But for planning purposes, the base_link frame is more convenient if it is in the middle of the robot's footprint. (The local map works like you want, for example.) Best to define base_link in your URDF as the middle of the robot footprint (however you define that), as well as a frame for midway between the rear wheels at a fixed offset from base_link, perhaps rear_midpoint_link. Then you can publish odometry relative to rear_midpoint_link. (Or transform yourself prior to publishing.)

more

About the possibility to synchronize the costmap with the robot heading, I found that you can set the following parameters in the configuration file:

 global_frame    : base_footprint
robot_base_frame: base_footprint


In this way, the costmap will follow the robot also in orientation changes. Hope it is useful.

more