bool KeyframeMapper::saveOctomapSrvCallback( Save::Request& request, Save::Response& response) { ROS_INFO("Saving map as Octomap..."); const std::string& path = request.filename; bool result = saveOctomap(path); if (result) ROS_INFO("Octomap saved to %s", path.c_str()); else ROS_ERROR("Octomap saving failed"); return result; }
///Connect Signals and Slots for the ui control void ui_connections(QObject* ui, GraphManager* graph_mgr, OpenNIListener* listener) { Qt::ConnectionType ctype = Qt::AutoConnection; if (ParameterServer::instance()->get<bool>("concurrent_io")) ctype = Qt::DirectConnection; QObject::connect(ui, SIGNAL(reset()), graph_mgr, SLOT(reset()), ctype); QObject::connect(ui, SIGNAL(optimizeGraph()), graph_mgr, SLOT(optimizeGraph()), ctype); QObject::connect(ui, SIGNAL(togglePause()), listener, SLOT(togglePause()), ctype); QObject::connect(ui, SIGNAL(toggleBagRecording()), listener, SLOT(toggleBagRecording()), ctype); QObject::connect(ui, SIGNAL(getOneFrame()), listener, SLOT(getOneFrame()), ctype); QObject::connect(ui, SIGNAL(deleteLastFrame()), graph_mgr, SLOT(deleteLastFrame()), ctype); QObject::connect(ui, SIGNAL(sendAllClouds()), graph_mgr, SLOT(sendAllClouds()), ctype); QObject::connect(ui, SIGNAL(saveAllClouds(QString)), graph_mgr, SLOT(saveAllClouds(QString)), ctype); QObject::connect(ui, SIGNAL(saveOctomapSig(QString)), graph_mgr, SLOT(saveOctomap(QString)), ctype); QObject::connect(ui, SIGNAL(saveAllFeatures(QString)), graph_mgr, SLOT(saveAllFeatures(QString)), ctype); QObject::connect(ui, SIGNAL(saveIndividualClouds(QString)), graph_mgr, SLOT(saveIndividualClouds(QString)), ctype); QObject::connect(ui, SIGNAL(saveTrajectory(QString)), graph_mgr, SLOT(saveTrajectory(QString)), ctype); QObject::connect(ui, SIGNAL(toggleMapping(bool)), graph_mgr, SLOT(toggleMapping(bool)), ctype); QObject::connect(ui, SIGNAL(saveG2OGraph(QString)), graph_mgr, SLOT(saveG2OGraph(QString)), ctype); }
QAction* Graphical_UI::createSaveMenu() {//octomap Menu QMenu* sm = menuBar()->addMenu(tr("&Save")); newMenuItem(sm, "&Save", SLOT(quickSaveAll()), "Save all stored point clouds with common coordinate frame to a pcd file", QKeySequence::Save, QIcon::fromTheme("document-save")); newMenuItem(sm, "Save &Feature Map...", SLOT(saveFeatures()), "Save all feature positions and descriptions in a common coordinate frame to a yaml or xml file", "Ctrl+F", QIcon::fromTheme("document-save")); QAction* oa = newMenuItem(sm, "Save Octomap...", SLOT(saveOctomap()), "Save computed OctoMap", "", QIcon::fromTheme("document-save-as")); newMenuItem(sm, "&Save as Point Cloud ...", SLOT(saveAll()), "Save all stored point clouds with common coordinate frame", QKeySequence::SaveAs, QIcon::fromTheme("document-save-as")); newMenuItem(sm, "&Save Point Cloud Node-Wise...", SLOT(saveIndividual()), "Save stored point clouds in individual files", "Ctrl+N", QIcon::fromTheme("document-save-all")); newMenuItem(sm, "Save &G2O Graph...", SLOT(saveG2OGraphDialog()), "Save G2O graph (e.g. for use with the g2o viewer or external optimization)", "", QIcon::fromTheme("document-save")); newMenuItem(sm, "Save Clouds to &Bag...", SLOT(saveBagDialog()), "Save clouds and transforms to bagfile", "Ctrl+Shift+B"); newMenuItem(sm, "Save Trajectory &Estimate...", SLOT(saveTrajectoryDialog()), "Save trajectory estimate (and ground truth trajectory if available) for external evaluation.", "Ctrl+E"); sm->addSeparator(); newMenuItem(sm, "&Send Model", SLOT(sendAll()), "Send out all stored point clouds with corrected transform", "Ctrl+M", QIcon::fromTheme("document-send")); sm->addSeparator(); newMenuItem(sm, "Save &3D as PDF File...", SLOT(saveVectorGraphic()), "Write 3D Scene to a PDF File. Warning: Meant for Pose Graphs not for the clouds or octomaps!", "", QIcon::fromTheme("application-pdf")); newMenuItem(sm, "Save Input &Images to Files...", SLOT(saveAllImages()), "Write All images shown in the gui to appropriate files", "", QIcon::fromTheme("image-x-generic")); newMenuItem(sm, "Capture Screencast...", this, SLOT(toggleScreencast(bool)), "Dump Screen as Video", !ParameterServer::instance()->get<std::string>("screencast_path_prefix").empty()); return oa; }