32 interface_names_.emplace_back(name_ +
"/" +
"orientation.x");
33 interface_names_.emplace_back(name_ +
"/" +
"orientation.y");
34 interface_names_.emplace_back(name_ +
"/" +
"orientation.z");
35 interface_names_.emplace_back(name_ +
"/" +
"orientation.w");
36 interface_names_.emplace_back(name_ +
"/" +
"angular_velocity.x");
37 interface_names_.emplace_back(name_ +
"/" +
"angular_velocity.y");
38 interface_names_.emplace_back(name_ +
"/" +
"angular_velocity.z");
39 interface_names_.emplace_back(name_ +
"/" +
"linear_acceleration.x");
40 interface_names_.emplace_back(name_ +
"/" +
"linear_acceleration.y");
41 interface_names_.emplace_back(name_ +
"/" +
"linear_acceleration.z");
44 orientation_.fill(std::numeric_limits<double>::quiet_NaN());
45 angular_velocity_.fill(std::numeric_limits<double>::quiet_NaN());
46 linear_acceleration_.fill(std::numeric_limits<double>::quiet_NaN());
59 size_t interface_offset = 0;
60 for (
size_t i = 0; i < orientation_.size(); ++i)
62 orientation_[i] = state_interfaces_[interface_offset + i].get().get_value();
75 size_t interface_offset = orientation_.size();
76 for (
size_t i = 0; i < angular_velocity_.size(); ++i)
78 angular_velocity_[i] = state_interfaces_[interface_offset + i].get().get_value();
80 return angular_velocity_;
91 size_t interface_offset = orientation_.size() + angular_velocity_.size();
92 for (
size_t i = 0; i < linear_acceleration_.size(); ++i)
94 linear_acceleration_[i] = state_interfaces_[interface_offset + i].get().get_value();
96 return linear_acceleration_;
113 message.orientation.x = orientation_[0];
114 message.orientation.y = orientation_[1];
115 message.orientation.z = orientation_[2];
116 message.orientation.w = orientation_[3];
118 message.angular_velocity.x = angular_velocity_[0];
119 message.angular_velocity.y = angular_velocity_[1];
120 message.angular_velocity.z = angular_velocity_[2];
122 message.linear_acceleration.x = linear_acceleration_[0];
123 message.linear_acceleration.y = linear_acceleration_[1];
124 message.linear_acceleration.z = linear_acceleration_[2];
131 std::array<double, 4> orientation_;
132 std::array<double, 3> angular_velocity_;
133 std::array<double, 3> linear_acceleration_;
bool get_values_as_message(sensor_msgs::msg::Imu &message)
Return Imu message with orientation, angular velocity and linear acceleration.
Definition imu_sensor.hpp:104