I’m running ArduPilot SITL + Gazebo (Armonic) + MAVROS + ROS2 Humble, using the official ArduPilot Gazebo plugin.
I’m facing a strange issue:
When I use MAVProxy manually:
mode guided
arm throttle
takeoff 5
The drone arms and takes off perfectly.
But when I use my ROS2 Python script with MAVROS to:
- switch to GUIDED
- arm
- publish position setpoints
- and perform a takeoff by commanding altitude
The drone does NOT take off.
The SITL console shows messages like:
AP: Arm: Need Position Estimate
AP: PreArm: Need Position Estimate
Got COMMAND_ACK: COMPONENT_ARM_DISARM: FAILED
Mode GUIDED
But the strange part is that if I do it running mavproxy and ROS commands, it works.
What my ROS2 script does:
- Waits for FCU connection
- Publishes setpoints at ~10 Hz on /mavros/setpoint_position/
- Calls /mavros/cmd/
- Calls /mavros/set_mode with "GUIDED"
- Sends a position target at (0,0,10)
The script compiles and runs without errors, but the drone never leaves the ground.
My question
Why does the drone take off correctly when using MAVProxy commands,but refuses to take off when performing the same sequence through MAVROS in ROS2?
What am I missing in the MAVROS/ROS2 workflow to allow the drone to arm and take off properly?
Any help or clarifications are greatly appreciated!