diff --git a/src/CoreWrapper.cpp b/src/CoreWrapper.cpp index 89ffa696..16d63087 100644 --- a/src/CoreWrapper.cpp +++ b/src/CoreWrapper.cpp @@ -112,6 +112,7 @@ CoreWrapper::CoreWrapper(bool deleteDbOnStart) : int queueSize = 10; bool publishTf = true; double tfDelay = 0.05; // 20 Hz + std::string tfPrefix = ""; bool stereoApproxSync = false; // ROS related parameters (private) @@ -144,11 +145,28 @@ CoreWrapper::CoreWrapper(bool deleteDbOnStart) : pnh.param("publish_tf", publishTf, publishTf); pnh.param("tf_delay", tfDelay, tfDelay); + pnh.param("tf_prefix", tfPrefix, tfPrefix); pnh.param("wait_for_transform", waitForTransform_, waitForTransform_); pnh.param("use_action_for_goal", useActionForGoal_, useActionForGoal_); pnh.param("gen_scan", genScan_, genScan_); pnh.param("gen_scan_max_depth", genScanMaxDepth_, genScanMaxDepth_); + if(!tfPrefix.empty()) + { + if(!frameId_.empty()) + { + frameId_ = tfPrefix+"/"+frameId_; + } + if(!mapFrameId_.empty()) + { + mapFrameId_ = tfPrefix+"/"+mapFrameId_; + } + if(!odomFrameId_.empty()) + { + odomFrameId_ = tfPrefix+"/"+odomFrameId_; + } + } + if(depthCameras <= 0 && subscribeDepth) { depthCameras = 1; diff --git a/src/GuiWrapper.cpp b/src/GuiWrapper.cpp index 7406f923..54a3df51 100644 --- a/src/GuiWrapper.cpp +++ b/src/GuiWrapper.cpp @@ -120,6 +120,7 @@ GuiWrapper::GuiWrapper(int & argc, char** argv) : bool subscribeStereo = false; int queueSize = 10; int depthCameras = 1; + std::string tfPrefix; pnh.param("frame_id", frameId_, frameId_); pnh.param("odom_frame_id", odomFrameId_, odomFrameId_); // set to use odom from TF pnh.param("subscribe_depth", subscribeDepth, subscribeDepth); @@ -128,8 +129,22 @@ GuiWrapper::GuiWrapper(int & argc, char** argv) : pnh.param("subscribe_stereo", subscribeStereo, subscribeStereo); pnh.param("depth_cameras", depthCameras, depthCameras); pnh.param("queue_size", queueSize, queueSize); + pnh.param("tf_prefix", tfPrefix, tfPrefix); pnh.param("wait_for_transform", waitForTransform_, waitForTransform_); - pnh.param("camera_node_name", cameraNodeName_, cameraNodeName_); // used to pause the rtabmap/camera when pausing the process + pnh.param("camera_node_name", cameraNodeName_, cameraNodeName_); // used to pause the rtabmap_ros/camera when pausing the process + + if(!tfPrefix.empty()) + { + if(!frameId_.empty()) + { + frameId_ = tfPrefix + "/" + frameId_; + } + if(!odomFrameId_.empty()) + { + odomFrameId_ = tfPrefix + "/" + odomFrameId_; + } + } + this->setupCallbacks( subscribeDepth, subscribeLaserScan, diff --git a/src/MapsManager.cpp b/src/MapsManager.cpp index 418d4888..dfdbe812 100644 --- a/src/MapsManager.cpp +++ b/src/MapsManager.cpp @@ -71,7 +71,7 @@ MapsManager::MapsManager() : // common map stuff pnh.param("map_filter_radius", mapFilterRadius_, mapFilterRadius_); pnh.param("map_filter_angle", mapFilterAngle_, mapFilterAngle_); - pnh.param("map_mapsManager_cleanup", mapCacheCleanup_, mapCacheCleanup_); + pnh.param("map_cleanup", mapCacheCleanup_, mapCacheCleanup_); // mapping topics cloudMapPub_ = nh.advertise("cloud_map", 1); diff --git a/src/OdometryROS.cpp b/src/OdometryROS.cpp index c9e2d5ef..a5bd4d0a 100644 --- a/src/OdometryROS.cpp +++ b/src/OdometryROS.cpp @@ -72,12 +72,31 @@ OdometryROS::OdometryROS(int argc, char * argv[]) : Transform initialPose = Transform::getIdentity(); std::string initialPoseStr; + std::string tfPrefix; pnh.param("frame_id", frameId_, frameId_); pnh.param("odom_frame_id", odomFrameId_, odomFrameId_); pnh.param("publish_tf", publishTf_, publishTf_); + pnh.param("tf_prefix", tfPrefix, tfPrefix); pnh.param("wait_for_transform", waitForTransform_, waitForTransform_); pnh.param("initial_pose", initialPoseStr, initialPoseStr); // "x y z roll pitch yaw" pnh.param("ground_truth_frame_id", groundTruthFrameId_, groundTruthFrameId_); + + if(!tfPrefix.empty()) + { + if(!frameId_.empty()) + { + frameId_ = tfPrefix + "/" + frameId_; + } + if(!odomFrameId_.empty()) + { + odomFrameId_ = tfPrefix + "/" + odomFrameId_; + } + if(!groundTruthFrameId_.empty()) + { + groundTruthFrameId_ = tfPrefix + "/" + groundTruthFrameId_; + } + } + if(initialPoseStr.size()) { std::vector values = uListToVector(uSplit(initialPoseStr, ' '));