I am attempting to control a fixed-wing drone in Offboard mode using MAVSDK. While I have successfully implemented this for multicopters, I am encountering issues with fixed-wing aircraft. Specifically, while position control works as expected, velocity control does not seem to function.
Controlling flight speed is critical for my application, but I am currently unable to adjust it. Below is the code snippet I used:
mavsdk::Offboard::PositionNedYaw posnedyaw {
.north_m = std::get<0>(position),
.east_m = std::get<1>(position),
.down_m = std::get<2>(position),
.yaw_deg = heading,
};
mavsdk::Offboard::VelocityNedYaw velnedyaw {
.north_m_s = std::get<0>(velocity),
.east_m_s = std::get<1>(velocity),
.down_m_s = std::get<2>(velocity),
.yaw_deg = heading,
};
_mav_offboard->set_position_velocity_ned(posnedyaw, velnedyaw);
Using this approach, the drone moves toward the target direction, but the speed remains constant and ignores the velocity setpoints. I also tried adding the following line to set the speed explicitly, but it had no effect:
_mav_action->set_current_speed(speed_mps);
I am aware that I could potentially change the speed by modifying the parameter FW_AIRSPD_TRIM:
_mav_param->set_param_float("FW_AIRSPD_TRIM", speed_mps);
However, updating parameters during flight for real-time control seems like an improper workaround. I also tested set_velocity_body as follows, but it still didn’t work:
mavsdk::Offboard::VelocityBodyYawspeed vel_body_yaw {
.forward_m_s = 20,
.right_m_s = 0,
.down_m_s = 0,
.yawspeed_deg_s = heading,
};
_mav_offboard->set_velocity_body(vel_body_yaw);
How can I effectively control the flight speed of a fixed-wing drone in Offboard mode? Am I missing a specific configuration or using the wrong MAVSDK functions for fixed-wing velocity setpoints?
P.S.
I initially considered posting this in the MAVSDK category since I am using that SDK. However, I decided to post it here because I believe the issue is more closely related to PX4’s Fixed-wing (FW) mode behavior and controller logic.