.. _program_listing_file_include_hri_body.hpp: Program Listing for File body.hpp ================================= |exhale_lsh| :ref:`Return to documentation for file ` (``include/hri/body.hpp``) .. |exhale_lsh| unicode:: U+021B0 .. UPWARDS ARROW WITH TIP LEFTWARDS .. code-block:: cpp // Copyright (c) 2023 PAL Robotics S.L. All rights reserved. // // 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. #ifndef HRI__BODY_HPP_ #define HRI__BODY_HPP_ #include #include #include #include "hri_msgs/msg/normalized_region_of_interest2_d.hpp" #include "hri_msgs/msg/skeleton2_d.hpp" #include "opencv2/core.hpp" #include "rclcpp/rclcpp.hpp" #include "sensor_msgs/msg/image.hpp" #include "std_msgs/msg/string.hpp" #include "tf2_ros/buffer.h" #include "hri/feature_tracker.hpp" #include "hri/types.hpp" namespace hri { // TODO(LJU): possibly subscribe also to the /joint_states, gesture and /posture sub-topics class Body : public FeatureTracker, public std::enable_shared_from_this { friend class HRIListener; // for invalidate() public: Body( ID id, NodeInterfaces node_interfaces, rclcpp::CallbackGroup::SharedPtr callback_group, const tf2::BufferCore & tf_buffer, const std::string & reference_frame); virtual ~Body(); std::optional roi() const {return roi_;} std::optional cropped() const {return cropped_;} std::optional skeleton() const {return skeleton_;} std::optional bodyDescription() const {return body_description_;} private: void onRoI(hri_msgs::msg::NormalizedRegionOfInterest2D::ConstSharedPtr msg); void onCropped(sensor_msgs::msg::Image::ConstSharedPtr msg); void onSkeleton(hri_msgs::msg::Skeleton2D::ConstSharedPtr msg); void onBodyDescription(std_msgs::msg::String::ConstSharedPtr msg); void invalidate(); std::optional roi_; std::optional cropped_; std::optional skeleton_; std::optional body_description_; rclcpp::Subscription::SharedPtr roi_subscriber_; rclcpp::Subscription::SharedPtr cropped_subscriber_; rclcpp::Subscription::SharedPtr skeleton_subscriber_; rclcpp::Subscription::SharedPtr body_description_subscriber_; }; typedef std::shared_ptr BodyPtr; typedef std::shared_ptr ConstBodyPtr; } // namespace hri #endif // HRI__BODY_HPP_