PX4 ROS 2 Interface Library
Library to interface with PX4 from a companion computer using ROS 2
land_detected.hpp
1 /****************************************************************************
2  * Copyright (c) 2023-2024 PX4 Development Team.
3  * SPDX-License-Identifier: BSD-3-Clause
4  ****************************************************************************/
5 
6 #pragma once
7 
8 #include <px4_msgs/msg/vehicle_land_detected.hpp>
9 #include <px4_ros2/common/context.hpp>
10 #include <px4_ros2/utils/subscription.hpp>
11 
12 namespace px4_ros2
13 {
23 class LandDetected : public Subscription<px4_msgs::msg::VehicleLandDetected>
24 {
25 public:
26  explicit LandDetected(Context & context)
27  : Subscription<px4_msgs::msg::VehicleLandDetected>(context, "fmu/out/vehicle_land_detected") {}
28 
34  bool landed() const
35  {
36  return last().landed;
37  }
38 
39 };
40 
42 } /* namespace px4_ros2 */
Definition: context.hpp:20
Provides access to the vehicle's status.
Definition: land_detected.hpp:24
bool landed() const
Check if vehicle is landed on the ground.
Definition: land_detected.hpp:34
Provides a subscription to arbitrary ROS topics.
Definition: subscription.hpp:23
const px4_msgs::msg::VehicleLandDetected & last() const
Get the last-received message.
Definition: subscription.hpp:58