sync build with rtabmap 0.10.4

This commit is contained in:
matlabbe
2015-08-03 18:21:00 -04:00
parent c240e75423
commit 833049a03f
2 changed files with 42 additions and 42 deletions
+1 -1
View File
@@ -17,7 +17,7 @@ find_package(octomap_ros)
## System dependencies are found with CMake's conventions ## System dependencies are found with CMake's conventions
# find_package(Boost REQUIRED COMPONENTS system) # find_package(Boost REQUIRED COMPONENTS system)
find_package(RTABMap 0.10.3 REQUIRED) find_package(RTABMap 0.10.4 REQUIRED)
find_package(OpenCV REQUIRED) find_package(OpenCV REQUIRED)
+41 -41
View File
@@ -300,41 +300,38 @@ void GuiWrapper::handleEvent(UEvent * anEvent)
} }
else if(cmd == rtabmap::RtabmapEventCmd::kCmdPause) else if(cmd == rtabmap::RtabmapEventCmd::kCmdPause)
{ {
if(cmdEvent->getInt()) // Pause the camera if the rtabmap/camera node is used
if(!cameraNodeName_.empty())
{ {
// Pause the camera if the rtabmap/camera node is used std::string str = uFormat("rosrun dynamic_reconfigure dynparam set %s pause true", cameraNodeName_.c_str());
if(!cameraNodeName_.empty()) system(str.c_str());
{
std::string str = uFormat("rosrun dynamic_reconfigure dynparam set %s pause true", cameraNodeName_.c_str());
system(str.c_str());
}
// Pause visual_odometry
ros::service::call("pause_odom", emptySrv);
// Pause rtabmap
if(!ros::service::call("pause", emptySrv))
{
ROS_ERROR("Can't call \"pause\" service");
}
} }
else
// Pause visual_odometry
ros::service::call("pause_odom", emptySrv);
// Pause rtabmap
if(!ros::service::call("pause", emptySrv))
{ {
// Resume rtabmap ROS_ERROR("Can't call \"pause\" service");
if(!ros::service::call("resume", emptySrv)) }
{ }
ROS_ERROR("Can't call \"resume\" service"); else if(cmd == rtabmap::RtabmapEventCmd::kCmdResume)
} {
// Resume rtabmap
if(!ros::service::call("resume", emptySrv))
{
ROS_ERROR("Can't call \"resume\" service");
}
// Pause visual_odometry // Pause visual_odometry
ros::service::call("resume_odom", emptySrv); ros::service::call("resume_odom", emptySrv);
// Resume the camera if the rtabmap/camera node is used // Resume the camera if the rtabmap/camera node is used
if(!cameraNodeName_.empty()) if(!cameraNodeName_.empty())
{ {
std::string str = uFormat("rosrun dynamic_reconfigure dynparam set %s pause false", cameraNodeName_.c_str()); std::string str = uFormat("rosrun dynamic_reconfigure dynparam set %s pause false", cameraNodeName_.c_str());
system(str.c_str()); system(str.c_str());
}
} }
} }
else if(cmd == rtabmap::RtabmapEventCmd::kCmdTriggerNewMap) else if(cmd == rtabmap::RtabmapEventCmd::kCmdTriggerNewMap)
@@ -344,15 +341,16 @@ void GuiWrapper::handleEvent(UEvent * anEvent)
ROS_ERROR("Can't call \"trigger_new_map\" service"); ROS_ERROR("Can't call \"trigger_new_map\" service");
} }
} }
else if(cmd == rtabmap::RtabmapEventCmd::kCmdPublish3DMapLocal || else if(cmd == rtabmap::RtabmapEventCmd::kCmdPublish3DMap)
cmd == rtabmap::RtabmapEventCmd::kCmdPublish3DMapGlobal ||
cmd == rtabmap::RtabmapEventCmd::kCmdPublishTOROGraphLocal ||
cmd == rtabmap::RtabmapEventCmd::kCmdPublishTOROGraphGlobal)
{ {
UASSERT(cmdEvent->value1().isBool());
UASSERT(cmdEvent->value2().isBool());
UASSERT(cmdEvent->value3().isBool());
rtabmap_ros::GetMap getMapSrv; rtabmap_ros::GetMap getMapSrv;
getMapSrv.request.global = cmd == rtabmap::RtabmapEventCmd::kCmdPublish3DMapGlobal || cmd == rtabmap::RtabmapEventCmd::kCmdPublishTOROGraphGlobal; getMapSrv.request.global = cmdEvent->value1().toBool();
getMapSrv.request.optimized = cmdEvent->getInt(); getMapSrv.request.optimized = cmdEvent->value2().toBool();
getMapSrv.request.graphOnly = cmd == rtabmap::RtabmapEventCmd::kCmdPublishTOROGraphGlobal || cmd == rtabmap::RtabmapEventCmd::kCmdPublishTOROGraphLocal; getMapSrv.request.graphOnly = cmdEvent->value3().toBool();
if(!ros::service::call("get_map", getMapSrv)) if(!ros::service::call("get_map", getMapSrv))
{ {
ROS_WARN("Can't call \"get_map\" service"); ROS_WARN("Can't call \"get_map\" service");
@@ -365,9 +363,10 @@ void GuiWrapper::handleEvent(UEvent * anEvent)
} }
else if(cmd == rtabmap::RtabmapEventCmd::kCmdGoal) else if(cmd == rtabmap::RtabmapEventCmd::kCmdGoal)
{ {
UASSERT(cmdEvent->value1().isStr() || cmdEvent->value1().isInt() || cmdEvent->value1().isUInt());
rtabmap_ros::SetGoal setGoalSrv; rtabmap_ros::SetGoal setGoalSrv;
setGoalSrv.request.node_id = cmdEvent->getInt(); setGoalSrv.request.node_id = !cmdEvent->value1().isStr()?cmdEvent->value1().toInt():0;
setGoalSrv.request.node_label = cmdEvent->getStr(); setGoalSrv.request.node_label = cmdEvent->value1().isStr()?cmdEvent->value1().toStr():"";
if(!ros::service::call("set_goal", setGoalSrv)) if(!ros::service::call("set_goal", setGoalSrv))
{ {
ROS_ERROR("Can't call \"set_goal\" service"); ROS_ERROR("Can't call \"set_goal\" service");
@@ -382,9 +381,10 @@ void GuiWrapper::handleEvent(UEvent * anEvent)
} }
else if(cmd == rtabmap::RtabmapEventCmd::kCmdLabel) else if(cmd == rtabmap::RtabmapEventCmd::kCmdLabel)
{ {
UASSERT(cmdEvent->value1().isStr() || cmdEvent->value1().isInt() || cmdEvent->value1().isUInt());
rtabmap_ros::SetLabel setLabelSrv; rtabmap_ros::SetLabel setLabelSrv;
setLabelSrv.request.node_id = cmdEvent->getInt(); setLabelSrv.request.node_id = !cmdEvent->value1().isStr()?cmdEvent->value1().toInt():0;
setLabelSrv.request.node_label = cmdEvent->getStr(); setLabelSrv.request.node_label = cmdEvent->value1().isStr()?cmdEvent->value1().toStr():"";
if(!ros::service::call("set_label", setLabelSrv)) if(!ros::service::call("set_label", setLabelSrv))
{ {
ROS_ERROR("Can't call \"set_label\" service"); ROS_ERROR("Can't call \"set_label\" service");