.. _program_listing_file_include_hri_person.hpp: Program Listing for File person.hpp =================================== |exhale_lsh| :ref:`Return to documentation for file ` (``include/hri/person.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__PERSON_HPP_ #define HRI__PERSON_HPP_ #include #include #include #include #include "geometry_msgs/msg/transform_stamped.hpp" #include "hri_msgs/msg/engagement_level.hpp" #include "std_msgs/msg/float32.hpp" #include "std_msgs/msg/string.hpp" #include "std_msgs/msg/bool.hpp" #include "tf2_ros/buffer.h" #include "hri/body.hpp" #include "hri/face.hpp" #include "hri/feature_tracker.hpp" #include "hri/types.hpp" #include "hri/voice.hpp" namespace hri { class HRIListener; class Person : public FeatureTracker, public std::enable_shared_from_this // TODO(LJU): possibly subscribe also to the /name and the /native_language sub-topics { friend class HRIListener; // for invalidate() public: Person( ID id, NodeInterfaces node_interfaces, rclcpp::CallbackGroup::SharedPtr callback_group, std::weak_ptr listener, const tf2::BufferCore & tf_buffer, const std::string & reference_frame); virtual ~Person(); ConstFacePtr face() const; ConstBodyPtr body() const; ConstVoicePtr voice() const; std::optional anonymous() const {return anonymous_;} std::optional engagementStatus() const {return engagement_status_;} std::optional locationConfidence() const {return loc_confidence_;} std::optional alias() const {return alias_;} std::optional transform() const override; private: void onFaceId(std_msgs::msg::String::ConstSharedPtr msg); void onBodyId(std_msgs::msg::String::ConstSharedPtr msg); void onVoiceId(std_msgs::msg::String::ConstSharedPtr msg); void onAnonymous(std_msgs::msg::Bool::ConstSharedPtr msg); void onAlias(std_msgs::msg::String::ConstSharedPtr msg); void onEngagementStatus(hri_msgs::msg::EngagementLevel::ConstSharedPtr msg); void onLocationConfidence(std_msgs::msg::Float32::ConstSharedPtr msg); void invalidate(); std::weak_ptr listener_; std::optional face_id_; std::optional body_id_; std::optional voice_id_; // if non-empty, this person 'does not exist' and is instead an alias to // another person. hri::getPersons and hri::getTrackedPersons will returns // pointers to the aliased person. std::optional alias_; std::optional anonymous_; std::optional engagement_status_; std::optional loc_confidence_; rclcpp::Subscription::SharedPtr face_id_subscriber_; rclcpp::Subscription::SharedPtr body_id_subscriber_; rclcpp::Subscription::SharedPtr voice_id_subscriber_; rclcpp::Subscription::SharedPtr anonymous_subscriber_; rclcpp::Subscription::SharedPtr alias_subscriber_; rclcpp::Subscription::SharedPtr engagement_subscriber_; rclcpp::Subscription::SharedPtr loc_confidence_subscriber_; }; typedef std::shared_ptr PersonPtr; typedef std::shared_ptr ConstPersonPtr; } // namespace hri #endif // HRI__PERSON_HPP_