PX4 ROS 2 Interface Library
Library to interface with PX4 from a companion computer using ROS 2
angular_velocity.hpp
1 /****************************************************************************
2  * Copyright (c) 2024 PX4 Development Team.
3  * SPDX-License-Identifier: BSD-3-Clause
4  ****************************************************************************/
5 
6 #pragma once
7 
8 #include <Eigen/Eigen>
9 #include <px4_msgs/msg/vehicle_angular_velocity.hpp>
10 #include <px4_ros2/common/context.hpp>
11 #include <px4_ros2/utils/subscription.hpp>
12 
13 namespace px4_ros2 {
21 class OdometryAngularVelocity : public Subscription<px4_msgs::msg::VehicleAngularVelocity> {
22  public:
23  explicit OdometryAngularVelocity(Context& context);
24 
30  Eigen::Vector3f angularVelocityFrd() const
31  {
32  const px4_msgs::msg::VehicleAngularVelocity& av = last();
33  return Eigen::Vector3f{av.xyz[0], av.xyz[1], av.xyz[2]};
34  }
35 };
36 
38 } /* namespace px4_ros2 */
Definition: context.hpp:18
Provides access to the vehicle's angular velocity estimate.
Definition: angular_velocity.hpp:21
Eigen::Vector3f angularVelocityFrd() const
Get the vehicle's angular velocity in FRD frame.
Definition: angular_velocity.hpp:30
Provides a subscription to arbitrary ROS topics.
Definition: subscription.hpp:27
const px4_msgs::msg::VehicleAngularVelocity & last() const
Get the last-received message.
Definition: subscription.hpp:57