.. _program_listing_file__tmp_ws_src_mocap4r2_mocap4r2_robot_gt_mocap4r2_robot_gt_include_mocap4r2_robot_gt_gt_component.hpp: Program Listing for File gt_component.hpp ========================================= |exhale_lsh| :ref:`Return to documentation for file ` (``/tmp/ws/src/mocap4r2/mocap4r2_robot_gt/mocap4r2_robot_gt/include/mocap4r2_robot_gt/gt_component.hpp``) .. |exhale_lsh| unicode:: U+021B0 .. UPWARDS ARROW WITH TIP LEFTWARDS .. code-block:: cpp // Copyright 2022 Intelligent Robotics Lab // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // Author: Jose Miguel Guerrero Hernandez #ifndef MOCAP4R2_ROBOT_GT__GTNODE_HPP_ #define MOCAP4R2_ROBOT_GT__GTNODE_HPP_ #include #include #include #include #include "mocap4r2_msgs/msg/rigid_bodies.hpp" #include "mocap4r2_robot_gt_msgs/srv/set_gt_origin.hpp" #include "rclcpp/rclcpp.hpp" namespace mocap4r2_robot_gt { class GTNode : public rclcpp::Node { public: explicit GTNode(const rclcpp::NodeOptions & options = rclcpp::NodeOptions()); protected: void rigid_bodies_callback(const mocap4r2_msgs::msg::RigidBodies::SharedPtr msg); void set_gt_origin_callback( const std::shared_ptr req, std::shared_ptr resp); geometry_msgs::msg::Pose get_pose_from_vector(const std::vector & init_pos); tf2::BufferCore tf_buffer_; tf2_ros::TransformListener tf_listener_; std::shared_ptr tf_broadcaster_; rclcpp::Subscription::SharedPtr rigid_body_sub_; rclcpp::Service::SharedPtr set_gt_origin_srv_; std::string root_frame_; std::string robot_frame_; std::string mocap_frame_; tf2::Transform offset_; tf2::Transform gtbody2robot_; tf2::Transform mocap2gtbody_; bool valid_gtbody2robot_{false}; }; } // namespace mocap4r2_robot_gt #endif // MOCAP4R2_ROBOT_GT__GTNODE_HPP_