locusrobotics / robot_navigation

Spiritual successor to ros-planning/navigation.
450 stars 148 forks source link

clear_costmap_service #64

Closed ThaparPiyush closed 4 years ago

ThaparPiyush commented 4 years ago

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();

recoverybehaviors.clear();

// first, we'll load a recovery behavior to clear the costmap boost::shared_ptr ags_clear( recoveryloader.createInstance("clear_costmap_recovery/ClearCostmapRecovery")); ags_clear->initialize("aggressive_reset", tf.get(), planner_costmapros, controller_costmapros); recoverybehaviors.push_back(ags_clear);

recoverybehaviors[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

ThaparPiyush commented 4 years ago

@DLu can you help me with this??

ThaparPiyush commented 4 years ago

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