14#ifndef SEMANTIC_COMPONENTS__POSE_SENSOR_HPP_
15#define SEMANTIC_COMPONENTS__POSE_SENSOR_HPP_
21#include "geometry_msgs/msg/pose.hpp"
22#include "semantic_components/semantic_component_interface.hpp"
24namespace semantic_components
34 interface_names_.emplace_back(name_ +
'/' +
"position.x");
35 interface_names_.emplace_back(name_ +
'/' +
"position.y");
36 interface_names_.emplace_back(name_ +
'/' +
"position.z");
37 interface_names_.emplace_back(name_ +
'/' +
"orientation.x");
38 interface_names_.emplace_back(name_ +
'/' +
"orientation.y");
39 interface_names_.emplace_back(name_ +
'/' +
"orientation.z");
40 interface_names_.emplace_back(name_ +
'/' +
"orientation.w");
43 std::fill(position_.begin(), position_.end(), std::numeric_limits<double>::quiet_NaN());
44 std::fill(orientation_.begin(), orientation_.end(), std::numeric_limits<double>::quiet_NaN());
57 for (
size_t i = 0; i < 3; ++i)
59 position_[i] = state_interfaces_[i].get().get_value();
73 for (
size_t i = 3; i < 7; ++i)
75 orientation_[i - 3] = state_interfaces_[i].get().get_value();
92 message.position.x = position_[0];
93 message.position.y = position_[1];
94 message.position.z = position_[2];
95 message.orientation.x = orientation_[0];
96 message.orientation.y = orientation_[1];
97 message.orientation.z = orientation_[2];
98 message.orientation.w = orientation_[3];
104 std::array<double, 3> position_;
105 std::array<double, 4> orientation_;
Definition pose_sensor.hpp:28
bool get_values_as_message(geometry_msgs::msg::Pose &message)
Fill pose message with current values.
Definition pose_sensor.hpp:85
std::array< double, 4 > get_orientation()
Update and return orientation.
Definition pose_sensor.hpp:71
PoseSensor(const std::string &name)
Constructor for a standard pose sensor with interface names set based on sensor name.
Definition pose_sensor.hpp:31
std::array< double, 3 > get_position()
Update and return position.
Definition pose_sensor.hpp:55
Definition semantic_component_interface.hpp:28