PX4 ROS 2 Interface Library
Library to interface with PX4 from a companion computer using ROS 2
Loading...
Searching...
No Matches
vehicle_command_sender.hpp
1/****************************************************************************
2 * Copyright (c) 2025 PX4 Development Team.
3 * SPDX-License-Identifier: BSD-3-Clause
4 ****************************************************************************/
5
6#pragma once
7
8#include <px4_msgs/msg/vehicle_command.hpp>
9#include <px4_msgs/msg/vehicle_command_ack.hpp>
10#include <px4_ros2/components/mode.hpp>
11#include <px4_ros2/utils/message_version.hpp>
12#include <rclcpp/rclcpp.hpp>
13#include <string>
14
15namespace px4_ros2 {
28 public:
35 explicit VehicleCommandSender(rclcpp::Node& node, std::string topic_namespace_prefix,
36 const std::string& command_topic = "fmu/in/vehicle_command");
37
47 Result sendCommandSync(px4_msgs::msg::VehicleCommand cmd);
48
49 private:
50 rclcpp::Node& _node;
51 std::string _topic_namespace_prefix;
52 rclcpp::Publisher<px4_msgs::msg::VehicleCommand>::SharedPtr _vehicle_command_pub;
53};
54
56} // namespace px4_ros2
Sends a VehicleCommand and waits synchronously for an ACK from PX4.
Definition vehicle_command_sender.hpp:27
Result sendCommandSync(px4_msgs::msg::VehicleCommand cmd)
Publish cmd and wait for a matching VehicleCommandAck.
VehicleCommandSender(rclcpp::Node &node, std::string topic_namespace_prefix, const std::string &command_topic="fmu/in/vehicle_command")
Result
Definition mode.hpp:29