-
Notifications
You must be signed in to change notification settings - Fork 24
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
aced150
commit 1ae6a38
Showing
4 changed files
with
62 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
40 changes: 40 additions & 0 deletions
40
px4_ros2_cpp/include/px4_ros2/odometry/angular_velocity.hpp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
/**************************************************************************** | ||
* Copyright (c) 2024 PX4 Development Team. | ||
* SPDX-License-Identifier: BSD-3-Clause | ||
****************************************************************************/ | ||
|
||
#pragma once | ||
|
||
#include <Eigen/Eigen> | ||
#include <px4_msgs/msg/vehicle_angular_velocity.hpp> | ||
#include <px4_ros2/common/context.hpp> | ||
#include <px4_ros2/odometry/subscription.hpp> | ||
|
||
namespace px4_ros2 | ||
{ | ||
/** \ingroup odometry | ||
* @{ | ||
*/ | ||
|
||
/** | ||
* @brief Provides access to the vehicle's angular velocity estimate | ||
*/ | ||
class OdometryAngularVelocity : public Subscription<px4_msgs::msg::VehicleAngularVelocity> | ||
{ | ||
public: | ||
explicit OdometryAngularVelocity(Context & context); | ||
|
||
/** | ||
* @brief Get the vehicle's angular velocity in FRD frame. | ||
* | ||
* @return the angular velocity | ||
*/ | ||
Eigen::Vector3f angularVelocityFrd() const | ||
{ | ||
const px4_msgs::msg::VehicleAngularVelocity & av = last(); | ||
return Eigen::Vector3f{av.xyz[0], av.xyz[1], av.xyz[2]}; | ||
} | ||
}; | ||
|
||
/** @}*/ | ||
} /* namespace px4_ros2 */ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
/**************************************************************************** | ||
* Copyright (c) 2023 PX4 Development Team. | ||
* SPDX-License-Identifier: BSD-3-Clause | ||
****************************************************************************/ | ||
|
||
#include <px4_ros2/odometry/angular_velocity.hpp> | ||
|
||
namespace px4_ros2 | ||
{ | ||
|
||
OdometryAngularVelocity::OdometryAngularVelocity(Context & context) | ||
: Subscription<px4_msgs::msg::VehicleAngularVelocity>(context, "fmu/out/vehicle_angular_velocity") | ||
{ | ||
RequirementFlags requirements{}; | ||
requirements.angular_velocity = true; | ||
context.setRequirement(requirements); | ||
} | ||
|
||
} // namespace px4_ros2 |