33class VehicleCommandClient
35 using VehicleCommand = px4_msgs::msg::VehicleCommand;
38 enum class FlightMode : uint8_t
40 Takeoff = px4_msgs::msg::VehicleStatus::NAVIGATION_STATE_AUTO_TAKEOFF,
41 Land = px4_msgs::msg::VehicleStatus::NAVIGATION_STATE_AUTO_LAND,
42 Hold = px4_msgs::msg::VehicleStatus::NAVIGATION_STATE_AUTO_LOITER,
43 RTL = px4_msgs::msg::VehicleStatus::NAVIGATION_STATE_AUTO_RTL,
44 Mission = px4_msgs::msg::VehicleStatus::NAVIGATION_STATE_AUTO_MISSION,
47 enum SendCommandResult : uint8_t
54 explicit VehicleCommandClient(
55 rclcpp::Node & node,
const std::chrono::milliseconds & command_timeout = std::chrono::milliseconds(500));
58 SendCommandResult syncSendVehicleCommand(
59 uint32_t command,
float param1 = NAN,
float param2 = NAN,
float param3 = NAN,
float param4 = NAN,
60 float param5 = NAN,
float param6 = NAN,
float param7 = NAN)
const;
63 SendCommandResult syncSendVehicleCommand(
const VehicleCommand & cmd)
const;
75 bool takeoff(
float altitude_amsl_m,
float heading_rad = NAN)
const;
79 bool syncActivateFlightMode(uint8_t mode_id)
const;
80 bool syncActivateFlightMode(
const FlightMode & mode)
const;
81 bool syncActivateFlightMode(
const px4_ros2::ModeBase *
const mode_ptr)
const;
85 const rclcpp::Logger logger_;
86 rclcpp::Publisher<px4_msgs::msg::VehicleCommand>::SharedPtr vehicle_command_pub_;
87 rclcpp::Subscription<px4_msgs::msg::VehicleCommandAck>::SharedPtr vehicle_command_ack_sub_;
88 const std::chrono::milliseconds command_timeout_;