I would like to clear the octomap after I performed a camera pose estimation. I first tried doing this using the move_group API directly, but I couldn't get this to work. I then saw moveit also supplies a plugin that can be used to clear the Octomap see the documentation. I created the following plugin_loader.cpp to load this plugin:
#include "ros/ros.h"
#include <pluginlib/class_loader.h>
#include <moveit/move_group/move_group_capability.h>
int main(int argc, char** argv)
{
// Initialize node
ros::init(argc, argv, "clear_cotomap_loader");
pluginlib::ClassLoader<move_group::MoveGroupCapability> move_Group_capability_loader("moveit_ros_move_group", "move_group::MoveGroupCapability");
try
{
boost::shared_ptr<move_group::MoveGroupCapability> clear_octomap = move_Group_capability_loader.createInstance("move_group/ClearOctomapService");
clear_octomap->initialize();
ROS_INFO("The clear octomap plugin was loaded successfully.");
}
catch(pluginlib::PluginlibException& ex)
{
ROS_ERROR("The plugin failed to load for some reason. Error: %s", ex.what());
}
ros::spin();
return 0;
}
Unfortunately, the move_group/clearOctomap service is not showing up when executing rossservice list command.
I added the following lines to my CMAKEList.txt file:
add_executable(clear_octomap_loader src/clear_octomap_loader.cpp)
target_link_libraries(
clear_octomap_loader
${catkin_LIBRARIES}
${Boost_LIBRARIES}
)
add_dependencies(
clear_octomap_loader
${${PROJECT_NAME}_EXPORTED_TARGETS} # Msgs, srv, actions of your package
${catkin_EXPORTED_TARGETS} # Msg, svr, action srv from other packages
)
Tell us how to reproduce this issue. Attempt to provide a working demo, perhaps using Docker.
I expected the move_group/clearOctomap service to show up when running therosservice list` command.
It did not.
Hi Rick,
with any recent MoveIt version, the capability is automatically loaded and provides the service /clear_octomap.
If you call this service, the Octomap maintained in the move_group node will be cleared.
@v4hn Thanks for your response. You are right thanks that's a lot easier!
Most helpful comment
Hi Rick,
with any recent MoveIt version, the capability is automatically loaded and provides the service
/clear_octomap.If you call this service, the Octomap maintained in the
move_groupnode will be cleared.