mirror of
https://github.com/introlab/rtabmap_ros.git
synced 2026-10-03 16:27:46 +08:00
Added tf_prefix to nodes using tf
This commit is contained in:
@@ -112,6 +112,7 @@ CoreWrapper::CoreWrapper(bool deleteDbOnStart) :
|
|||||||
int queueSize = 10;
|
int queueSize = 10;
|
||||||
bool publishTf = true;
|
bool publishTf = true;
|
||||||
double tfDelay = 0.05; // 20 Hz
|
double tfDelay = 0.05; // 20 Hz
|
||||||
|
std::string tfPrefix = "";
|
||||||
bool stereoApproxSync = false;
|
bool stereoApproxSync = false;
|
||||||
|
|
||||||
// ROS related parameters (private)
|
// ROS related parameters (private)
|
||||||
@@ -144,11 +145,28 @@ CoreWrapper::CoreWrapper(bool deleteDbOnStart) :
|
|||||||
|
|
||||||
pnh.param("publish_tf", publishTf, publishTf);
|
pnh.param("publish_tf", publishTf, publishTf);
|
||||||
pnh.param("tf_delay", tfDelay, tfDelay);
|
pnh.param("tf_delay", tfDelay, tfDelay);
|
||||||
|
pnh.param("tf_prefix", tfPrefix, tfPrefix);
|
||||||
pnh.param("wait_for_transform", waitForTransform_, waitForTransform_);
|
pnh.param("wait_for_transform", waitForTransform_, waitForTransform_);
|
||||||
pnh.param("use_action_for_goal", useActionForGoal_, useActionForGoal_);
|
pnh.param("use_action_for_goal", useActionForGoal_, useActionForGoal_);
|
||||||
pnh.param("gen_scan", genScan_, genScan_);
|
pnh.param("gen_scan", genScan_, genScan_);
|
||||||
pnh.param("gen_scan_max_depth", genScanMaxDepth_, genScanMaxDepth_);
|
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)
|
if(depthCameras <= 0 && subscribeDepth)
|
||||||
{
|
{
|
||||||
depthCameras = 1;
|
depthCameras = 1;
|
||||||
|
|||||||
+16
-1
@@ -120,6 +120,7 @@ GuiWrapper::GuiWrapper(int & argc, char** argv) :
|
|||||||
bool subscribeStereo = false;
|
bool subscribeStereo = false;
|
||||||
int queueSize = 10;
|
int queueSize = 10;
|
||||||
int depthCameras = 1;
|
int depthCameras = 1;
|
||||||
|
std::string tfPrefix;
|
||||||
pnh.param("frame_id", frameId_, frameId_);
|
pnh.param("frame_id", frameId_, frameId_);
|
||||||
pnh.param("odom_frame_id", odomFrameId_, odomFrameId_); // set to use odom from TF
|
pnh.param("odom_frame_id", odomFrameId_, odomFrameId_); // set to use odom from TF
|
||||||
pnh.param("subscribe_depth", subscribeDepth, subscribeDepth);
|
pnh.param("subscribe_depth", subscribeDepth, subscribeDepth);
|
||||||
@@ -128,8 +129,22 @@ GuiWrapper::GuiWrapper(int & argc, char** argv) :
|
|||||||
pnh.param("subscribe_stereo", subscribeStereo, subscribeStereo);
|
pnh.param("subscribe_stereo", subscribeStereo, subscribeStereo);
|
||||||
pnh.param("depth_cameras", depthCameras, depthCameras);
|
pnh.param("depth_cameras", depthCameras, depthCameras);
|
||||||
pnh.param("queue_size", queueSize, queueSize);
|
pnh.param("queue_size", queueSize, queueSize);
|
||||||
|
pnh.param("tf_prefix", tfPrefix, tfPrefix);
|
||||||
pnh.param("wait_for_transform", waitForTransform_, waitForTransform_);
|
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(
|
this->setupCallbacks(
|
||||||
subscribeDepth,
|
subscribeDepth,
|
||||||
subscribeLaserScan,
|
subscribeLaserScan,
|
||||||
|
|||||||
+1
-1
@@ -71,7 +71,7 @@ MapsManager::MapsManager() :
|
|||||||
// common map stuff
|
// common map stuff
|
||||||
pnh.param("map_filter_radius", mapFilterRadius_, mapFilterRadius_);
|
pnh.param("map_filter_radius", mapFilterRadius_, mapFilterRadius_);
|
||||||
pnh.param("map_filter_angle", mapFilterAngle_, mapFilterAngle_);
|
pnh.param("map_filter_angle", mapFilterAngle_, mapFilterAngle_);
|
||||||
pnh.param("map_mapsManager_cleanup", mapCacheCleanup_, mapCacheCleanup_);
|
pnh.param("map_cleanup", mapCacheCleanup_, mapCacheCleanup_);
|
||||||
|
|
||||||
// mapping topics
|
// mapping topics
|
||||||
cloudMapPub_ = nh.advertise<sensor_msgs::PointCloud2>("cloud_map", 1);
|
cloudMapPub_ = nh.advertise<sensor_msgs::PointCloud2>("cloud_map", 1);
|
||||||
|
|||||||
@@ -72,12 +72,31 @@ OdometryROS::OdometryROS(int argc, char * argv[]) :
|
|||||||
|
|
||||||
Transform initialPose = Transform::getIdentity();
|
Transform initialPose = Transform::getIdentity();
|
||||||
std::string initialPoseStr;
|
std::string initialPoseStr;
|
||||||
|
std::string tfPrefix;
|
||||||
pnh.param("frame_id", frameId_, frameId_);
|
pnh.param("frame_id", frameId_, frameId_);
|
||||||
pnh.param("odom_frame_id", odomFrameId_, odomFrameId_);
|
pnh.param("odom_frame_id", odomFrameId_, odomFrameId_);
|
||||||
pnh.param("publish_tf", publishTf_, publishTf_);
|
pnh.param("publish_tf", publishTf_, publishTf_);
|
||||||
|
pnh.param("tf_prefix", tfPrefix, tfPrefix);
|
||||||
pnh.param("wait_for_transform", waitForTransform_, waitForTransform_);
|
pnh.param("wait_for_transform", waitForTransform_, waitForTransform_);
|
||||||
pnh.param("initial_pose", initialPoseStr, initialPoseStr); // "x y z roll pitch yaw"
|
pnh.param("initial_pose", initialPoseStr, initialPoseStr); // "x y z roll pitch yaw"
|
||||||
pnh.param("ground_truth_frame_id", groundTruthFrameId_, groundTruthFrameId_);
|
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())
|
if(initialPoseStr.size())
|
||||||
{
|
{
|
||||||
std::vector<std::string> values = uListToVector(uSplit(initialPoseStr, ' '));
|
std::vector<std::string> values = uListToVector(uSplit(initialPoseStr, ' '));
|
||||||
|
|||||||
Reference in New Issue
Block a user