-
Notifications
You must be signed in to change notification settings - Fork 93
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add possibility to change parent_child_id #31
Closed
Closed
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
{ | ||
"files.associations": { | ||
"*.tcc": "cpp", | ||
"bitset": "cpp", | ||
"istream": "cpp", | ||
"ostream": "cpp", | ||
"*.cps": "javascript", | ||
"*.h": "cpp", | ||
"charconv": "cpp", | ||
"array": "cpp", | ||
"string_view": "cpp", | ||
"*.old": "cpp", | ||
"*.bkp": "cpp", | ||
"unordered_map": "cpp", | ||
"unordered_set": "cpp", | ||
"functional": "cpp", | ||
"deque": "cpp", | ||
"string": "cpp", | ||
"vector": "cpp", | ||
"cctype": "cpp", | ||
"clocale": "cpp", | ||
"cmath": "cpp", | ||
"cstdarg": "cpp", | ||
"cstddef": "cpp", | ||
"cstdio": "cpp", | ||
"cstdlib": "cpp", | ||
"cstring": "cpp", | ||
"ctime": "cpp", | ||
"cwchar": "cpp", | ||
"cwctype": "cpp", | ||
"atomic": "cpp", | ||
"hash_map": "cpp", | ||
"hash_set": "cpp", | ||
"chrono": "cpp", | ||
"complex": "cpp", | ||
"condition_variable": "cpp", | ||
"cstdint": "cpp", | ||
"forward_list": "cpp", | ||
"list": "cpp", | ||
"exception": "cpp", | ||
"algorithm": "cpp", | ||
"iterator": "cpp", | ||
"map": "cpp", | ||
"memory": "cpp", | ||
"memory_resource": "cpp", | ||
"numeric": "cpp", | ||
"optional": "cpp", | ||
"random": "cpp", | ||
"ratio": "cpp", | ||
"set": "cpp", | ||
"system_error": "cpp", | ||
"tuple": "cpp", | ||
"type_traits": "cpp", | ||
"utility": "cpp", | ||
"fstream": "cpp", | ||
"initializer_list": "cpp", | ||
"iomanip": "cpp", | ||
"iosfwd": "cpp", | ||
"iostream": "cpp", | ||
"limits": "cpp", | ||
"mutex": "cpp", | ||
"new": "cpp", | ||
"sstream": "cpp", | ||
"stdexcept": "cpp", | ||
"streambuf": "cpp", | ||
"thread": "cpp", | ||
"cinttypes": "cpp", | ||
"typeindex": "cpp", | ||
"typeinfo": "cpp", | ||
"bit": "cpp" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -71,6 +71,7 @@ class AprilTagNode : public rclcpp::Node { | |
// parameter | ||
std::mutex mutex; | ||
double tag_edge_size; | ||
std::string parent_frame_id; | ||
std::atomic<int> max_hamming; | ||
std::atomic<bool> profile; | ||
std::unordered_map<int, std::string> tag_frames; | ||
|
@@ -81,7 +82,6 @@ class AprilTagNode : public rclcpp::Node { | |
const image_transport::CameraSubscriber sub_cam; | ||
const rclcpp::Publisher<apriltag_msgs::msg::AprilTagDetectionArray>::SharedPtr pub_detections; | ||
tf2_ros::TransformBroadcaster tf_broadcaster; | ||
|
||
pose_estimation_f estimate_pose = nullptr; | ||
|
||
void onCamera(const sensor_msgs::msg::Image::ConstSharedPtr& msg_img, const sensor_msgs::msg::CameraInfo::ConstSharedPtr& msg_ci); | ||
|
@@ -110,6 +110,7 @@ AprilTagNode::AprilTagNode(const rclcpp::NodeOptions& options) | |
// read-only parameters | ||
const std::string tag_family = declare_parameter("family", "36h11", descr("tag family", true)); | ||
tag_edge_size = declare_parameter("size", 1.0, descr("default tag size", true)); | ||
parent_frame_id = declare_parameter("parent_frame_id", "odom", descr("the frame id which is odom by default", true)); | ||
|
||
// get tag names, IDs and sizes | ||
const auto ids = declare_parameter("tag.ids", std::vector<int64_t>{}, descr("tag ids", true)); | ||
|
@@ -215,6 +216,7 @@ void AprilTagNode::onCamera(const sensor_msgs::msg::Image::ConstSharedPtr& msg_i | |
// 3D orientation and position | ||
geometry_msgs::msg::TransformStamped tf; | ||
tf.header = msg_img->header; | ||
tf.header.frame_id = parent_frame_id; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This will override the frame ID from the camera in which frame the tag is detected and there is no way to prevent this. |
||
// set child frame name by generic tag name or configured tag name | ||
tf.child_frame_id = tag_frames.count(det->id) ? tag_frames.at(det->id) : std::string(det->family->name) + ":" + std::to_string(det->id); | ||
const double size = tag_sizes.count(det->id) ? tag_sizes.at(det->id) : tag_edge_size; | ||
|
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do not commit personal IDE settings.