Offboard landing request with px4 V1.6.5 and 1.7.0 in LPE mode no longer working


Since september 2016, I have been using successfully offboard with companion board to command the autopilot.

For landing and takeoff procedure, I have used the hidden bithmask of the SET_POSITION_TARGET_LOCAL_NED message

PX4-Autopilot/mavlink_receiver.cpp at 2f48317a9ea7b05d8c61b3d1c44f8229491350b1 · PX4/PX4-Autopilot · GitHub
Here are the threads describing the usage : Offboard automatic TakeOff / Landing using MAV_CMD_LAND/TAKEOFF_LOCAL - #4 by tdo and Offboard mode and mavlink message for this mode - #3 by tdo

I have used this setup with Dropix (px4 V1.4.4) and Pixhawk2.1 with HERE gps (px4 V1.5.5). They both have been working great using HITL (jmavsim) and real drone (hexacopter and quadcopter).

Now I’m trying to use px4 V1.6.5 or V1.7.0 (pixhawk 2.1 hardware, HERE gps) and landing is no longer working, at least in HITL with JMAVSIM. The UAV keep howering to the last Z position I gave it.
I have tried to set an altitude under the ground in conjonction with the landing bitmask. In this case it’ll reach the ground but will take lots of time to detect landing (>10s) and really often it will says : ‘landing detected’ followed immediately by ‘takeoff detected’. Also I’m not sure whether the flight stack knows it is landing phase (in which case, the drone just try to reach the requested altitude in the SET_POSITION_TARGET_LOCAL_NED)
This is problematic as my companion board expect the MAV_LANDED_STATE_ON_GROUND from the MAVLINK_MSG_ID_EXTENDED_SYS_STATE msg to send the disarm command.

Is there something I need to change in companion code in order to perform a proper landing in offboard mode.

Thank you for your helps.

Probably you need to add some log in mc_pos_control, especially line 1527(git tag v1.7.2).
If everything goes well, here _vel_sp(2) should be set to land_speed param. Besides this, you need to make sure the other type_masks are set properly.
It seems that the order is not received in here. :slight_smile:


Sorry for the long delay. Do you mean I have to change px4 code ?
Using companion board was a way to avoid changing px4 code and creating side problem as I do not have enough time to test a flight stack :s

As a workarount I’m a developing my ‘own landing code’ for offboard board : requesting a setpoint way above ground level and detect UAV is no longer descending and confirming information with a sonar sensor (already present on my setup). But it is not clean and It would be nice if offboard was working as before in version 1.4.4 and 1.5.5 (LPE)

Actually, what I said is not to change the core code of PX4, just add some log output to ensure your command did send and is received by PX4 correctly. Because I think there are many “traps” in offboard mode control logic.
Based on the tutorials of land detector, indeed it is possible that it takes up to 10 sec to read landed state if the drone keeps rotating.


I now understand your meaning. As far as I can tell, the order is well send (as it works in 1.4.4 and 1.5.5 version of px4). Also by using the version 1.7.0, I know that the order is received because if I change the Z position request, the autopilot tries to reach this Z setpoint. Also, I know that the UAV does not consider itself in the landing states : with version 1.4.4 and 1.5.5, with the same Order, the UAV was gently descending at the speed resquested in the parameters, with px4 version 1.7.0 (same offboard software used with 1.4.4. and 1.5.5), the UAV stays at the last Z setpoint requested (in my case it is always 2,5 meters above ground level)

But you gave me an idea : perhaps I was not correctly using the landing bitmask and should indicates to the autopilot to ignore the Z setpoint. I’ll let you know whether this works

Can you help me (by showing me a discussion thread or tuto) how to enable this particular log you mention ?

Thank you

Finally I have changed my bitmask for landing. The formal version working with px4 1.4.4. and 1.5.5 was this one :

#define APWT_MAVLINK_SETPOINT_LAND_SP (0x2000 | 0b110111000011)

Now I’m using this one on px4 1.7.0 and landing is performed as expected

#define APWT_MAVLINK_SETPOINT_LAND_SP (0x2000 | 0b110111000111)
The Z setpoint is now ignored.

However, touchdown is not correctly detected but I have seen another thread indicating it was possible for a landing @ 0,5 m/s to be not detected (even more by using a simulator). I’ll try this code with real hardware very soon and let you know how it works.

As far as I know, the land detector does have some delay.
Usually, I use sonar or lidar to detect it is really close to the ground, and then directly go to disarm the drone.

I also have a sonar as a backup solution to disarm the drone if it still armed 4 seconds after it has stopped it’s descent. But I’ll prefer if px4 flight stack detects the landing by itself.

I think, from the code, once if you have disarmed the drone, the land detector would be directly go to landed.