Added tf_prefix to nodes using tf

This commit is contained in:
Mathieu Labbe
2015-06-17 16:04:06 -04:00
parent e5c0c01acc
commit 206dda272e
4 changed files with 54 additions and 2 deletions
+18
View File
@@ -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;
+16 -1
View File
@@ -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,
+1 -1
View File
@@ -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<sensor_msgs::PointCloud2>("cloud_map", 1);
+19
View File
@@ -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<std::string> values = uListToVector(uSplit(initialPoseStr, ' '));