ros-planning / navigation

ROS Navigation stack. Code for finding where the robot is and how it can get somewhere else.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

navfn (getPlanFromPotential or makePlan) is not using the last updated map form costmap_2d

MortezaHagh opened this issue · comments

I noticed that occasionally (mostly when working with big maps) the global_plan intersects with obstacles when using move_base to navigate to a goal. This shouldn't be a problem since the global_plan gets updated frequently. However, if a node requests a global plan from makePlan or computePotential+getPlanFromPotential, this can cause a problem.

I checked the following functions:

1- NavfnROS::computePotential:

planner_->setCostmap(costmap_->getCharMap(), true, allow_unknown_);

2- NavFn::setCostmap

NavFn::setCostmap(const COSTTYPE *cmap, bool isROS, bool allow_unknown)
... costarr is updated based on cmap values ....

and I saved the costarr after requesting a path several times.
You can see in the following pictures that the created costarr is different for the same map.

test2
test1

This may be because the costmaps was being updated and used simultaneously. So, I tested this solution and it worked:

  • add two other costmaps (unsigned char* costmap) to the costmap_2d.
  • use pointer swapping to always point to the last updated map.

Am I missing a point or this is a real bug?

Is it possible to create a pr? Thanks!