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/message_version.hpp>
11 #include <px4_ros2/utils/subscription.hpp>
12 
13 namespace px4_ros2 {
23 class LandDetected : public Subscription<px4_msgs::msg::VehicleLandDetected> {
24  public:
25  explicit LandDetected(Context& context)
27  context, "fmu/out/vehicle_land_detected" +
28  px4_ros2::getMessageNameVersion<px4_msgs::msg::VehicleLandDetected>())
29  {
30  }
31 
37  bool landed() const { return last().landed; }
38 };
39 
41 } /* namespace px4_ros2 */
Definition: context.hpp:18
Provides access to the vehicle's status.
Definition: land_detected.hpp:23
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:27
const px4_msgs::msg::VehicleLandDetected & last() const
Get the last-received message.
Definition: subscription.hpp:57