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 #include <px4_ros2/utils/message_version.hpp>
12 
13 namespace px4_ros2
14 {
24 class LandDetected : public Subscription<px4_msgs::msg::VehicleLandDetected>
25 {
26 public:
27  explicit LandDetected(Context & context)
29  "fmu/out/vehicle_land_detected" +
30  px4_ros2::getMessageNameVersion<px4_msgs::msg::VehicleLandDetected>()) {}
31 
37  bool landed() const
38  {
39  return last().landed;
40  }
41 
42 };
43 
45 } /* namespace px4_ros2 */
Definition: context.hpp:20
Provides access to the vehicle's status.
Definition: land_detected.hpp:25
bool landed() const
Check if vehicle is landed on the ground.
Definition: land_detected.hpp:37
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