Takeoff & loitering in offboard mode with a quadcopter

I’m using:

  • Snapdragon Flight with Qualcomm image 3.1.3
  • Mavros Kinetic
  • PX4/Firmware branch global_to_local (keeps PX4 from treating lack of GPS as lack of position for certain modes)
  • Qualcomm VISLAM altered to operate with mavros

I’m attempting to use mavros’ setpoint_raw topic to launch the vehicle upward and then set it to loiter in its current position once it reaches height. I perform these behaviors by setting the type_mask field of the PositionTarget message to 0x1000 | 0b110111000011 for takeoff. It instructs PX4 to ignore XY position, XYZ accel, and yaw_[rate] properties. In simulation, the vehicle takes off almost straight up and then drifts slightly at height-- no loiter mode is even needed in this case. During actual flight, the vehicle takes off at an angle and continues to move forward at a decent speed (0.3m/s perhaps) without stopping. See it here. I kill it at the end.

Next, I tried setting the type_mask to loiter with value 0x3000 | (1 << 1) | (7 << 6) | (7 << 3) (the loiter mask ORed with the default value used in mavlink for a standard setpoint command) once the vehicle had been in the air for a couple seconds. It did not seem to attempt to stop.

So here are some questions:

  1. Am I invoking the wrong takeoff function? Is PX4 trying to launch my quadcopter like a fixed wing vehicle?
  2. If I’m invoking the correct takeoff function, how do I make the takeoff vertical?
  3. VISLAM sends its calculated position (it does calculate a position) to mavros/vision_pose/pose_cov. Should I be seeing a position coming back from PX4 at the mavros topic /mavros/local_position/pose topic? Nothing is published there.
  4. Which bits of configuration or settings should I check to ensure that takeoff and loiter work properly?

Thanks for your help.

Hello,
I am working in a very similar setup with you.
AFAIK, the takeoff function is started by navigotor, and implemented and executed in mc_pos_control module.
I used offboard mode and hacked some code in mc_pos_control to adjust to my drone.
The original logic of taking off is to use velocity control with certain velocity setpoint.
The reason for drifting after takeoff might be the calibration of the level of the drone, or other unbalanced load from my experience.
The best way to debug it is to add some log, especially in navigator, commander and mc_pos_control module.
Another question from me, I am curious how you make the VISLAM work?
All I can see from atlflight repo is a ROS related repo, seems not complete yet?
Thank you very much.

1 Like