PX4 ROS 2 Interface Library
Library to interface with PX4 from a companion computer using ROS 2
Loading...
Searching...
No Matches
message_compatibility_check.hpp
1/****************************************************************************
2 * Copyright (c) 2023 PX4 Development Team.
3 * SPDX-License-Identifier: BSD-3-Clause
4 ****************************************************************************/
5
6#pragma once
7
8#include <rclcpp/rclcpp.hpp>
9using namespace std::chrono_literals; // NOLINT
10
11// clang-format off
12// Set of all messages used by the library (<topic_name>[, <topic_type>])
13#define ALL_PX4_ROS2_MESSAGES \
14 {"fmu/in/actuator_motors"}, \
15 {"fmu/in/actuator_servos"}, \
16 {"fmu/in/arming_check_reply"}, \
17 {"fmu/in/aux_global_position"}, \
18 {"fmu/in/config_overrides_request", "ConfigOverrides"}, \
19 {"fmu/in/fixed_wing_lateral_setpoint"}, \
20 {"fmu/in/fixed_wing_longitudinal_setpoint"}, \
21 {"fmu/in/goto_setpoint"}, \
22 {"fmu/in/lateral_control_configuration"}, \
23 {"fmu/in/longitudinal_control_configuration"}, \
24 {"fmu/in/mode_completed"}, \
25 {"fmu/in/register_ext_component_request"}, \
26 {"fmu/in/setpoint_config"}, \
27 {"fmu/in/trajectory_setpoint"}, \
28 {"fmu/in/unregister_ext_component"}, \
29 {"fmu/in/vehicle_attitude_setpoint"}, \
30 {"fmu/in/vehicle_command"}, \
31 {"fmu/in/vehicle_command_mode_executor", "VehicleCommand"}, \
32 {"fmu/in/vehicle_rates_setpoint"}, \
33 {"fmu/in/vehicle_visual_odometry", "VehicleOdometry"}, \
34 {"fmu/out/airspeed_validated"}, \
35 {"fmu/out/arming_check_request"}, \
36 {"fmu/out/battery_status"}, \
37 {"fmu/out/config_overrides_confirm", "ConfigOverrides"}, \
38 {"fmu/out/home_position"}, \
39 {"fmu/out/manual_control_setpoint"}, \
40 {"fmu/out/mode_completed"}, \
41 {"fmu/out/register_ext_component_reply"}, \
42 {"fmu/out/setpoint_config_reply"}, \
43 {"fmu/out/vehicle_attitude"}, \
44 {"fmu/out/vehicle_angular_velocity"}, \
45 {"fmu/out/vehicle_command_ack"}, \
46 {"fmu/out/vehicle_global_position"}, \
47 {"fmu/out/vehicle_land_detected"}, \
48 {"fmu/out/vehicle_local_position"}, \
49 {"fmu/out/vehicle_status"}, \
50 {"fmu/out/vtol_vehicle_status"}, \
51 {"fmu/out/vehicle_odometry"} \
52 PX4_ROS2_SURFACE_VEHICLE_MESSAGES
53// Messages only available in px4_msgs versions that provide the SurfaceVehicle* messages
54#if !defined(PX4_ROS2_HAS_SURFACE_VEHICLE_MSGS) || PX4_ROS2_HAS_SURFACE_VEHICLE_MSGS
55#define PX4_ROS2_SURFACE_VEHICLE_MESSAGES \
56 , {"fmu/in/surface_vehicle_attitude_setpoint"} \
57 , {"fmu/in/surface_vehicle_course_setpoint"} \
58 , {"fmu/in/surface_vehicle_position_setpoint"} \
59 , {"fmu/in/surface_vehicle_rate_setpoint"} \
60 , {"fmu/in/surface_vehicle_speed_setpoint"} \
61 , {"fmu/in/surface_vehicle_steering_setpoint"} \
62 , {"fmu/in/surface_vehicle_thrust_setpoint"}
63#else
64#define PX4_ROS2_SURFACE_VEHICLE_MESSAGES
65#endif
66// clang-format on
67
68namespace px4_ros2 {
74 std::string topic_name;
75 std::string
77};
78
97bool messageCompatibilityCheck(rclcpp::Node& node,
98 const std::vector<MessageCompatibilityTopic>& messages_to_check,
99 const std::string& topic_namespace_prefix = "");
100
102} // namespace px4_ros2
bool messageCompatibilityCheck(rclcpp::Node &node, const std::vector< MessageCompatibilityTopic > &messages_to_check, const std::string &topic_namespace_prefix="")
Check for a set of messages that match the definitions used by PX4.
Definition message_compatibility_check.hpp:73
std::string topic_type
e.g. VehicleStatus. If empty, it's inferred from the topic_name // NOLINT
Definition message_compatibility_check.hpp:76
std::string topic_name
e.g. "fmu/out/vehicle_status"
Definition message_compatibility_check.hpp:74