Skip to content

Commit

Permalink
allow overriding of the tf child frame ids so multiple instances of a…
Browse files Browse the repository at this point in the history
…ruco_detect won't conflict
  • Loading branch information
lucasw committed May 30, 2024
1 parent 501b839 commit 8c4b4ff
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions aruco_detect/src/aruco_detect.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,8 @@ class FiducialsNode {

double fiducial_len;

std::string tf_prefix;

bool doPoseEstimation;
bool haveCamInfo;
bool publishFiducialTf;
Expand Down Expand Up @@ -510,15 +512,15 @@ void FiducialsNode::poseEstimateCallback(const FiducialArrayConstPtr & msg)
ts.transform.rotation.z = q.z();
ts.header.frame_id = frameId;
ts.header.stamp = msg->header.stamp;
ts.child_frame_id = "fiducial_" + std::to_string(ids[i]);
ts.child_frame_id = tf_prefix + std::to_string(ids[i]);
broadcaster.sendTransform(ts);
}
else {
geometry_msgs::TransformStamped ts;
ts.transform = ft.transform;
ts.header.frame_id = frameId;
ts.header.stamp = msg->header.stamp;
ts.child_frame_id = "fiducial_" + std::to_string(ft.fiducial_id);
ts.child_frame_id = tf_prefix + std::to_string(ft.fiducial_id);
broadcaster.sendTransform(ts);
}
}
Expand Down Expand Up @@ -614,6 +616,8 @@ FiducialsNode::FiducialsNode() : nh(), pnh("~"), it(nh)
pnh.param<bool>("vis_msgs", vis_msgs, false);
pnh.param<bool>("verbose", verbose, false);

pnh.param<std::string>("tf_prefix", tf_prefix, "fiducial_");

std::string str;
std::vector<std::string> strs;

Expand Down

0 comments on commit 8c4b4ff

Please sign in to comment.