Cannot takeoff using VEHICLE_CMD_NAV_TAKEOFF


I have followed this tutorial for offboard control with ROS2 : ROS 2 Offboard Control Example | PX4 User Guide.

Everything is working fine but now I am trying to play a bit with this script. I want to takeoff the drone using the command VEHICLE_CMD_NAV_TAKEOFF (seen in VehicleCommand (UORB message) | PX4 User Guide).

I modified the timer_callback to :

auto timer_callback = [this]() -> void {

			if (offboard_setpoint_counter_ == 10) {
				// Arm the vehicle


			// stop the counter after reaching 11
			if (offboard_setpoint_counter_ < 11) {

My problem is that when I run this in gazebo with QGroundControl also opened, the drone arms (the propellers rotate in gazebo) and I see a message saying “Warning: Using minimum takeoff altitude: 2.50m” but the drone doesn’t move.

I might be doing something wrong but I don’t understand why it doesn’t work. Could someone please help me ?

Thanks !

Another interesting thing: I changed the script with VEHICLE_CMD_NAV_LAND instead of VEHICLE_CMD_NAV_TAKEOFF.

In QGroundControl I ask the drone to takeoff (it works), then I launch the ROS node that is supposed to land with this modified script and it works.

Hi @Toto,

Actually, you don’t need to enter the offboard control mode to use commands from the VehicleCommand topic.

I’m not using gazebo, but jmavsim, and for me everything work fine so far.
I would suggest to have a better look to the message definition in the message reference, because depending on the used command you need to set up to seven parameters, maybe that’s why it isn’t working.

What I do, is to subscribe to VehicleGlobalPosition to set the longitude, latitude and altitude and VehicleOdometry to keep the same yaw angle. Then, I first send the arm command, and then the takeoff command

1 Like