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