How to make a "preferred" area

asked 2018-05-30 06:17:42 -0500

starter gravatar image

updated 2018-06-05 03:48:30 -0500

Hi , My goal is to make the robot prefer to plan a path through a zone on the map, therefore i changed the FREE_SPACE ( you can find it in cost_values.h) cost from 0 to 50 and i made a layer that draws a zone that has 0 as cost. The problem is when the robot gets close to the zone, its cost goes from 0 to 50 which means that the cost of the map and the zone become similar but I need the cost of the zone to stay 0.

Thank you in advance.


Hi, I found out that the problem is coming from the obstacle layer it is replacing any cost below the FREE_SPACE with the value of FREE_SPACE, I am not really sure if what I am doing is correct, did anybody do something similar before or has an idea how this could be done. Do not hesitate if you have questions, thank you.

edit retag flag offensive close merge delete


Maybe you can assign cost to rest of the map, leaving the zone as free_space, this should solve the problem you are having.

Choco93 gravatar image Choco93  ( 2018-06-08 05:46:31 -0500 )edit

Yes it worked ! I just made a layer with cost 50 over all the points that has 0 as cost and on top of that layer I am drawing my "preferred layer", Thank you.

starter gravatar image starter  ( 2018-06-26 09:17:44 -0500 )edit

@starter Hi sir can you elaborate on how you added the extra layer with 50 costs, and how are you drawing the layer? form rviz or something else?

Ammar Albakri gravatar image Ammar Albakri  ( 2022-06-01 09:45:10 -0500 )edit