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
35 name, {{name +
'/' +
"position.x"},
36 {name +
'/' +
"position.y"},
37 {name +
'/' +
"position.z"},
38 {name +
'/' +
"orientation.x"},
39 {name +
'/' +
"orientation.y"},
40 {name +
'/' +
"orientation.z"},
41 {name +
'/' +
"orientation.w"}})
53 update_data_from_interfaces();
54 std::array<double, 3> position;
55 std::copy(data_.begin(), data_.begin() + 3, position.begin());
68 update_data_from_interfaces();
69 std::array<double, 4> orientation;
70 std::copy(data_.begin() + 3, data_.end(), orientation.begin());
84 update_data_from_interfaces();
86 message.position.x = data_[0];
87 message.position.y = data_[1];
88 message.position.z = data_[2];
89 message.orientation.x = data_[3];
90 message.orientation.y = data_[4];
91 message.orientation.z = data_[5];
92 message.orientation.w = data_[6];
104 void update_data_from_interfaces()
const
106 for (
auto i = 0u; i < data_.size(); ++i)
108 const auto data = state_interfaces_[i].get().get_optional();
109 if (data.has_value())
111 data_[i] = data.value();
119 mutable std::array<double, 7> data_{{0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0}};
Definition pose_sensor.hpp:28
std::array< double, 4 > get_orientation() const
Update and return orientation.
Definition pose_sensor.hpp:66
PoseSensor(const std::string &name)
Constructor for a standard pose sensor with interface names set based on sensor name.
Definition pose_sensor.hpp:33
std::array< double, 3 > get_position() const
Update and return position.
Definition pose_sensor.hpp:51
bool get_values_as_message(geometry_msgs::msg::Pose &message) const
Fill pose message with current values.
Definition pose_sensor.hpp:82
Definition semantic_component_interface.hpp:29