diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 0000000..2e1408d --- /dev/null +++ b/.vscode/settings.json @@ -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" + } +} \ No newline at end of file diff --git a/src/AprilTagNode.cpp b/src/AprilTagNode.cpp index 5f646a3..3056ddb 100644 --- a/src/AprilTagNode.cpp +++ b/src/AprilTagNode.cpp @@ -71,6 +71,7 @@ class AprilTagNode : public rclcpp::Node { // parameter std::mutex mutex; double tag_edge_size; + std::string parent_frame_id; std::atomic max_hamming; std::atomic profile; std::unordered_map tag_frames; @@ -81,7 +82,6 @@ class AprilTagNode : public rclcpp::Node { const image_transport::CameraSubscriber sub_cam; const rclcpp::Publisher::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{}, 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; // 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;