mirror of
https://github.com/introlab/rtabmap_ros.git
synced 2026-10-04 00:37:46 +08:00
rviz: added downloadGraph property
added relays for images on az3_mapping_client_rviz launch file git-svn-id: http://rtabmap.googlecode.com/svn/trunk/ros-pkg@1583 f169173b-cf89-36c8-b27e-44dbe73f0c83
This commit is contained in:
@@ -131,6 +131,10 @@ MapCloudDisplay::MapCloudDisplay()
|
||||
"Download the optimized global map using rtabmap/GetMap service. This will force to re-create all clouds.",
|
||||
this, SLOT( downloadMap() ), this );
|
||||
|
||||
download_graph_ = new rviz::BoolProperty( "Download graph", false,
|
||||
"Download the optimized global graph (without cloud data) using rtabmap/GetMap service.",
|
||||
this, SLOT( downloadGraph() ), this );
|
||||
|
||||
// PointCloudCommon sets up a callback queue with a thread for each
|
||||
// instance. Use that for processing incoming messages.
|
||||
update_nh_.setCallbackQueue( &cbqueue_ );
|
||||
@@ -491,6 +495,61 @@ void MapCloudDisplay::downloadMap()
|
||||
}
|
||||
}
|
||||
|
||||
void MapCloudDisplay::downloadGraph()
|
||||
{
|
||||
if(download_graph_->getBool())
|
||||
{
|
||||
rtabmap::GetMap getMapSrv;
|
||||
getMapSrv.request.global = true;
|
||||
getMapSrv.request.optimized = true;
|
||||
getMapSrv.request.graphOnly = true;
|
||||
ros::NodeHandle nh;
|
||||
QMessageBox * messageBox = new QMessageBox(
|
||||
QMessageBox::NoIcon,
|
||||
tr("Calling \"%1\" service...").arg(nh.resolveName("rtabmap/get_map").c_str()),
|
||||
tr("Downloading the graph... please wait (rviz could become gray!)"),
|
||||
QMessageBox::NoButton);
|
||||
messageBox->setAttribute(Qt::WA_DeleteOnClose, true);
|
||||
messageBox->show();
|
||||
QApplication::processEvents();
|
||||
uSleep(100); // hack make sure the text in the QMessageBox is shown...
|
||||
QApplication::processEvents();
|
||||
if(!ros::service::call("rtabmap/get_map", getMapSrv))
|
||||
{
|
||||
ROS_ERROR("MapCloudDisplay: Can't call \"%s\" service. "
|
||||
"Tip: if rtabmap node is not in rtabmap namespace, you can remap the service "
|
||||
"to \"get_map\" in the launch "
|
||||
"file like: <remap from=\"rtabmap/get_map\" to=\"get_map\"/>.",
|
||||
nh.resolveName("rtabmap/get_map").c_str());
|
||||
messageBox->setText(tr("MapCloudDisplay: Can't call \"%1\" service. "
|
||||
"Tip: if rtabmap node is not in rtabmap namespace, you can remap the service "
|
||||
"to \"get_map\" in the launch "
|
||||
"file like: <remap from=\"rtabmap/get_map\" to=\"get_map\"/>.").
|
||||
arg(nh.resolveName("rtabmap/get_map").c_str()));
|
||||
}
|
||||
else
|
||||
{
|
||||
messageBox->setText(tr("Updating the map (%1 nodes downloaded)...").arg(getMapSrv.response.data.poses.size()));
|
||||
QApplication::processEvents();
|
||||
processMapData(getMapSrv.response.data);
|
||||
messageBox->setText(tr("Updating the map (%1 nodes downloaded)... done!").arg(getMapSrv.response.data.poses.size()));
|
||||
|
||||
QTimer::singleShot(1000, messageBox, SLOT(close()));
|
||||
}
|
||||
download_graph_->blockSignals(true);
|
||||
download_graph_->setBool(false);
|
||||
download_graph_->blockSignals(false);
|
||||
}
|
||||
else
|
||||
{
|
||||
// just stay true if double-clicked on DownloadGraph property, let the
|
||||
// first process above finishes
|
||||
download_graph_->blockSignals(true);
|
||||
download_graph_->setBool(true);
|
||||
download_graph_->blockSignals(false);
|
||||
}
|
||||
}
|
||||
|
||||
void MapCloudDisplay::causeRetransform()
|
||||
{
|
||||
needs_retransform_ = true;
|
||||
|
||||
@@ -84,6 +84,7 @@ public:
|
||||
rviz::FloatProperty* node_filtering_radius_;
|
||||
rviz::FloatProperty* node_filtering_angle_;
|
||||
rviz::BoolProperty* download_map_;
|
||||
rviz::BoolProperty* download_graph_;
|
||||
|
||||
public Q_SLOTS:
|
||||
void causeRetransform();
|
||||
@@ -98,6 +99,7 @@ private Q_SLOTS:
|
||||
void setColorTransformerOptions( EnumProperty* prop );
|
||||
void updateCloudParameters();
|
||||
void downloadMap();
|
||||
void downloadGraph();
|
||||
|
||||
protected:
|
||||
/** @brief Do initialization. Overridden from MessageFilterDisplay. */
|
||||
|
||||
Reference in New Issue
Block a user