diff --git a/launch/azimut3/az3_mapping_client_rviz.launch b/launch/azimut3/az3_mapping_client_rviz.launch index ca048356..5ac3e066 100644 --- a/launch/azimut3/az3_mapping_client_rviz.launch +++ b/launch/azimut3/az3_mapping_client_rviz.launch @@ -5,10 +5,11 @@ - - - - + + + + + @@ -18,19 +19,14 @@ - diff --git a/launch/config/azimut3.rviz b/launch/config/azimut3.rviz index e34ec16a..8ca49f56 100644 --- a/launch/config/azimut3.rviz +++ b/launch/config/azimut3.rviz @@ -7,7 +7,6 @@ Panels: - /Global Options1 - /TF1/Frames1 - /Info1 - - /Info1/Status1 Splitter Ratio: 0.5 Tree Height: 527 - Class: rviz/Selection @@ -62,7 +61,7 @@ Visualization Manager: Color: 255; 255; 255 Color Transformer: RGB8 Decay Time: 0 - Enabled: false + Enabled: true Invert Rainbow: false Max Color: 255; 255; 255 Max Intensity: 2.34177e-38 @@ -78,7 +77,7 @@ Visualization Manager: Topic: /voxel_cloud Use Fixed Frame: true Use rainbow: true - Value: false + Value: true - Class: rviz/TF Enabled: true Frame Timeout: 15 @@ -156,8 +155,8 @@ Visualization Manager: - Alpha: 1 Autocompute Intensity Bounds: true Autocompute Value Bounds: - Max Value: 0.167568 - Min Value: -4.37384 + Max Value: 0.526358 + Min Value: -2.54801 Value: true Axis: X Channel Name: intensity @@ -200,6 +199,61 @@ Visualization Manager: Expand Link Details: false Expand Tree: false Link Tree Style: Links in Alphabetic Order + base_footprint: + Alpha: 1 + Show Axes: false + Show Trail: false + Value: true + base_laser_link: + Alpha: 1 + Show Axes: false + Show Trail: false + Value: true + base_link: + Alpha: 1 + Show Axes: false + Show Trail: false + Value: true + wheelLB_linkWheel_link: + Alpha: 1 + Show Axes: false + Show Trail: false + Value: true + wheelLB_wheel_link: + Alpha: 1 + Show Axes: false + Show Trail: false + Value: true + wheelLF_linkWheel_link: + Alpha: 1 + Show Axes: false + Show Trail: false + Value: true + wheelLF_wheel_link: + Alpha: 1 + Show Axes: false + Show Trail: false + Value: true + wheelRB_linkWheel_link: + Alpha: 1 + Show Axes: false + Show Trail: false + Value: true + wheelRB_wheel_link: + Alpha: 1 + Show Axes: false + Show Trail: false + Value: true + wheelRF_linkWheel_link: + Alpha: 1 + Show Axes: false + Show Trail: false + Value: true + wheelRF_wheel_link: + Alpha: 1 + Show Axes: false + Show Trail: false + Value: true Name: RobotModel Robot Description: robot_description TF Prefix: "" @@ -208,14 +262,14 @@ Visualization Manager: Visual Enabled: true - Class: rviz/Image Enabled: true - Image Topic: /camera/data_throttled_image + Image Topic: /camera/data_throttled_image_relay Max Value: 1 Median window: 5 Min Value: 0 Name: Image Normalize Range: true Queue Size: 2 - Transport Hint: theora + Transport Hint: raw Value: true - Alpha: 1 Autocompute Intensity Bounds: true @@ -231,6 +285,7 @@ Visualization Manager: Cloud voxel size (m): 0.02 Color: 255; 255; 255 Color Transformer: RGB8 + Download graph: false Download map: false Enabled: true Invert Rainbow: false diff --git a/src/rviz/MapCloudDisplay.cpp b/src/rviz/MapCloudDisplay.cpp index 19d0f913..9c202c27 100644 --- a/src/rviz/MapCloudDisplay.cpp +++ b/src/rviz/MapCloudDisplay.cpp @@ -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: .", + 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: ."). + 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; diff --git a/src/rviz/MapCloudDisplay.h b/src/rviz/MapCloudDisplay.h index 54dcf0fa..22c81143 100644 --- a/src/rviz/MapCloudDisplay.h +++ b/src/rviz/MapCloudDisplay.h @@ -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. */