Offboard automatic TakeOff / Landing using MAV_CMD_LAND/TAKEOFF_LOCAL

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.

  seq: 476
secs: 1536097946
nsecs: 216237762
  frame_id: ''
coordinate_frame: 1
type_mask: 11719
  x: 0.0
  y: 0.0
  z: 0.0
  x: 0.0
  y: 0.0
  z: -1.0
  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 :
I dont see any MAV_SET message as SET_POSITION_TARGET_LOCAL_NED.

Can you please help me out.

1 Like

Indoor, use Mavros or dronecore. Dronekit is awesome for normal missions management and fast applications outdoor.

1 Like

Hey Alexis, Thanks a lot for replying.
I see that dronecore does not have a Python API yet or am I missing something?

Not yet, mavros can but you’ll need a lot of deps.

Dronecore can already be used with python but not yet officially released

Hey Alexis, I am unable to find any references to Dronecode in python. Can you please help me find it?

Here’s the link to the DronecodeSDK Python library

1 Like

Unfortunately, offboard is not exposed in Python just yet, but you could give the C++ library a try.

1 Like

@JulianOes, is the only for simulation?

Offboard mode and some plugins haven’t been ported to Python yet, but the code available for python (such as examples) should be able to run in your vehicle.

@JulianOes, is the takeoff_and_land.py2 only for simulation?

Not at all. It’s just easiest to test in simulation. To use it in real, you have to change the line where the connection is set up, e.g. to serial if you’re using a 3DR radio.

i am a student and i am new to UAV.I searched the mavros package and finally find

void set_position_target_local_ned(uint32_t time_boot_ms, uint8_t coordinate_frame,uint16_t type_mask,Eigen::Vector3d p,Eigen::Vector3d v,Eigen::Vector3d af,float yaw, float yaw_rate)
mavros::UAS *m_uas_ = static_cast<D *>(this)->m_uas;
mavlink::common::msg::SET_POSITION_TARGET_LOCAL_NED sp;
sp.time_boot_ms = time_boot_ms;
sp.coordinate_frame = coordinate_frame;
sp.type_mask = type_mask;
sp.yaw = yaw;
sp.yaw_rate = yaw_rate;
sp.x = p.x();
sp.y = p.y();
sp.z = p.z();
sp.vx = v.x();
sp.vy = v.y();
sp.vz = v.z();
sp.afx = af.x();
sp.afy = af.y();
sp.afz = af.z();

and i am wondering
1)can i COMMUNICATE with px4 and make UAV move
just use the function with my parameter like this
< set_position_target_local_ned(A,B,C,D,E,F,G) > ??

  1. how to use these MAV_CMD_********

3)Are there any examples that I can follow?
i appreciate it very very much.
I really need your help, thank you.

@sudo please create a new thread and don’t necro-bump this old post. Thank you.