locusrobotics/robot_navigation

clear_costmap_service

ThaparPiyush opened this issue · 2 comments

Hi, I am using locomove_base in ros-kinetic on ubuntu16.04 and was facing some problem with costmap_clear. My robot is publishing the message of clearing cost but its not clearing the costmap. I even tried adding a subscriber in locomove_base.cpp so that I can clear costmap whenever I need to but the same thing happens the message is being published but costmaps aren't clearing. Is there some other way to clear costmaps manually?
and this is the subscriber I added to clear costmap:

void LocoMoveBase::clearCostmap(const std_msgs::EmptyConstPtr& msg)
{
ROS_INFO("Clearing costmap....");

TFListenerPtr tf = locomotor_.getTFListener();

recovery_behaviors_.clear();

// first, we'll load a recovery behavior to clear the costmap
boost::shared_ptr<nav_core::RecoveryBehavior> ags_clear(
recovery_loader_.createInstance("clear_costmap_recovery/ClearCostmapRecovery"));
ags_clear->initialize("aggressive_reset", tf.get(), planner_costmap_ros_, controller_costmap_ros_);
recovery_behaviors_.push_back(ags_clear);

recovery_behaviors_[0]->runBehavior();
}

I am attaching the images which show that even after blocking the path costmaps aren't cleaning.
Screenshot from 2020-08-17 18-26-43
Screenshot from 2020-08-17 18-28-54

@DLu can you help me with this??

Thanks but I solved my problem, I added the layers to be cleared in the clear costmap param file and it worked.