Offboard automatic TakeOff / Landing using MAV_CMD_LAND/TAKEOFF_LOCAL

Hello,

Thank you for your help.

As I have indicated this method is OK for takeoff but don’t work for Landing as drift may occur in altitude estimation and UAV might hover some inch above the ground. Also it is not ‘clean’ as the drone does not know it’s a takeoff phase (not indicated in message)

The solution is to use SET_POSITION_TARGET_LOCAL_NED and ORing the bitmask with the value 0x2000 (land setpoint) or 0x1000 (Takeoff setpoint).

Thanks to ‘land setpoint bitmask’, even if the setpoint is above the real groud, the UAV will continue it’s descent until it reached the ground.

However it is a good idea to use current location for X and Y information (ensuring a vertical takeoff/landing)

Thanks for the reply,

This will certainly help me out. I had no idea of this bitmask.

Can I ask when the land_sp is enabled, is the position even relevant? or will it land regardless?

It will move to the horizontal position you set but ignore the Z part of the setpoint as it will determine itself when its on the ground. To not get into a diagonal landing my recommendation is to first move to the landing spot on flight height and then engage the landing.

Thanks,

This will surely prove useful.

Wow, a lot of good information in this thread. Just a thought. If you are using LPE (which is the default in the latest firmware release), then you might want to add an optical flow to avoid any drifting.

That is something to consider.

Do you know the altitude range of the optical flow in meters?

If you happen to know anything about the “hidden bitmasks” related to setpoint modes, could you consider adding some input in this thread.

I would like some clarity on the topic.

Patrick

We only use it for indoor test-flights, but I believe the altitude range is 5 meters.

No, I didn’t know about those “hidden bitmasks” either. I’m curious about that too so you might want to post that question in the PX4 Gitter as well.

Sounds Good,

My goal was to get a complete description in one place, So myself/future users don’t have to go searching everywhere.

Thanks again,

Patrick

Did you reach this goal and posted the complete description?

1 Like

@tdo Do you set the is_takeoff_sp once or do you keep it enable until it reaches the desired_altitude (target.z)?

0b0001110111111000 vs 0b0000110111111000

I do set the is_takeoff_sp at takeoff and keep it until I reach at least 3 meters (even if the target z given is higher than 3 meters). At that point (3 meters), I switch to a ‘normal’ SET_POSITION_TARGET_LOCAL_NED message (without using the extra bitfield functionnality).

Here is my takeoff bitfield

(0x1000 | 0b110111000011)

Hi,
Have you successfully flown your drone indoor?

Hi, happy to see this convenient way to realize takeoff/landing in offboard mode but that seems doesn’t work for me. I tried these bitmasks as you said. When I used this bitfield to takeoff,

the drone in JMAVSIM didn’t move. I expect the drone will take off to the default altitude. The target position was set as follows:
target.x = current.x
target.y = current.y
target.z = current.z

I really need your help, thank you.

Hello,

From some time now I do use this bitfield for taking off (work with version 1.6.5) : (0x1000 | 0b100111000000)
For target.z you can try current.z - 5; (this will request a takeoff point 5 meters above the current location, as the z axis in inversed).

Are you in correct offboard mode. To do so you have to send a HEARTBEAT at 2Hz and a request to switch to offboard mode MAV_CMD_NAV_GUIDED_ENABLE.

And then you also need to arm the drone using MAV_CMD_COMPONENT_ARM_DISARM. These two command are ‘long command’ type.

Hope this will help you. I’ll be glad to help you if it’s not the case

Thank you,
I can arm the drone and takeoff, but I can not land as you said “even if the setpoint is above the real groud, the UAV will continue it’s descent until it reached the ground”. I set the LAND bitmask and target.z = current.z, but the drone do not land and hovering at current.z potion. Whether I need other configuration?

Thank you very much,
I finally land succeed using the bitmask by changing (0x2000 | 0b110111000011) to (0x2000 | 0b110111000111).

Sorry I was in holiday and did not see your message :frowning: my bad. I do use the same bitfield you have provided for landing with px4 1.6.5. ((0x2000 | 0b110111000111)).

Did you tried it on newer version of the px4 firmware ?

Thank you

Yes I tried it on px4 1.7.0.

Hi, i am also trying to landing/takeoff using the masking bits but havent been successful. i am able to move the drone using /setpoint_raw/local topic (movement via both position and velocity works). but when i set the landing bit 0x2000 or takeoff bit, the drone stays at the same spot. here is my setpoint_raw msg for landing (the drones hovers at a fixed point). not sure what i am doing wrong.

header: 
  seq: 476
  stamp: 
secs: 1536097946
nsecs: 216237762
  frame_id: ''
coordinate_frame: 1
type_mask: 11719
position: 
  x: 0.0
  y: 0.0
  z: 0.0
velocity: 
  x: 0.0
  y: 0.0
  z: -1.0
acceleration_or_force: 
  x: 0.0
  y: 0.0
  z: 0.5
yaw: 0.0
yaw_rate: 0.0

Hey, i am new to dronekit.
I am working on flying the quad using NED as i want to test the drone indoors. I am able to change the mode and arm the vehicle, but i cant seem to find a message to take off using NED. and altitude.
I dont see any command referenced in the : https://github.com/PX4/Firmware/blob/master/Tools/mavlink_px4.py
I dont see any MAV_SET message as SET_POSITION_TARGET_LOCAL_NED.

Can you please help me out.

1 Like