# MAVSDK integration with Yuneec Mantis Q

**URL:** <https://discuss.px4.io/t/mavsdk-integration-with-yuneec-mantis-q/11960>\
**Category:** MAVSDK\
**Created:** [July 16, 2019, 3:12pm UTC](https://discuss.px4.io/t/mavsdk-integration-with-yuneec-mantis-q/11960 "2019-07-16T15:12:33Z")\
**Posts on this page:** 11\
**Page:** 1

<div class="post-metadata">

**Author:** ![mburgund](https://discuss.px4.io/user_avatar/discuss.px4.io/mburgund/32/4008_2.png) [@mburgund](https://discuss.px4.io/u/mburgund)\
**Post date:** [July 16, 2019, 3:12pm UTC](https://discuss.px4.io/t/mavsdk-integration-with-yuneec-mantis-q/11960/1 "2019-07-16T15:12:33Z")

</div>

Hello there,

I’m trying to integrate a MAVSDK application with a Yuneec Mantis Q drone that I recently purchased. This particular application (same one from [here](https://discuss.px4.io/t/control-px4-gazebo-sim-from-networked-mavsdk/11617)) was tested against a px4\_sitl running with the gazebo simulator, and even can control the Yuneec Typhoon H480 model.

However, when I try to use it or the [takeoff\_and\_land demo](https://github.com/mavlink/MAVSDK/blob/develop/example/takeoff_land/takeoff_and_land.cpp), it notifies that a new system came online and has a camera component but does not actually discover it in the Mavsdk::system() sense and exits.

When I test the Mantis Q with QGroundControl, it is somehow able to correctly connect to the drone. But when I command it to take off, the motors rev up until it’s about to take off and then it generates an error and quits. That may be a separate issue (related to [this](https://discuss.px4.io/t/qgc-cant-connect-to-mantis-q-to-update-firmware/11484) issue maybe?) but it still remains that QGroundControl know the secret to connect to Mantis Q that the other two applications don’t. Perhaps some kind of maximum supported version or maybe Mantis Q doesn’t use Mavlink 2.0 messages, I don’t know.

If anybody is familiar with Yuneec’s series of drones and can lend a hand, or just has some helpful debugging advice, I’d really appreciate it.  
-Mitchell

---

<div class="post-metadata">

**Author:** ![mburgund](https://discuss.px4.io/user_avatar/discuss.px4.io/mburgund/32/4008_2.png) [@mburgund](https://discuss.px4.io/u/mburgund)\
**Post date:** [July 16, 2019, 3:18pm UTC](https://discuss.px4.io/t/mavsdk-integration-with-yuneec-mantis-q/11960/2 "2019-07-16T15:18:08Z")

</div>

This is the output from running the takeoff\_and\_land demo:

> user@CUSTOM-CONTROLLER-NAME:/path/to/demo$ ./takeoff\_and\_land udp://:14550  
> [11:52:10|Info] DronecodeSDK version: 0.17.0 (dronecode\_sdk\_impl.cpp:25)  
> [11:52:10|Debug] New: System ID: 0 Comp ID: 0 (dronecode\_sdk\_impl.cpp:338)  
> Waiting to discover system…  
> [11:52:10|Info] New system on: 192.168.42.1:14551 (udp\_connection.cpp:226)  
> [11:52:10|Debug] Component Camera 1 (100) added. (system\_impl.cpp:400)  
> No system found, exiting.

---

<div class="post-metadata">

**Author:** ![JulianOes](https://discuss.px4.io/user_avatar/discuss.px4.io/julianoes/32/30_2.png) [@JulianOes](https://discuss.px4.io/u/JulianOes)\
**Post date:** [July 22, 2019, 1:50pm UTC](https://discuss.px4.io/t/mavsdk-integration-with-yuneec-mantis-q/11960/3 "2019-07-22T13:50:59Z")

</div>

So it finds the camera but not the autopilot.

Howe are you connected to the Mantis Q?

---

<div class="post-metadata">

**Author:** ![mburgund](https://discuss.px4.io/user_avatar/discuss.px4.io/mburgund/32/4008_2.png) [@mburgund](https://discuss.px4.io/u/mburgund)\
**Post date:** [July 22, 2019, 2:06pm UTC](https://discuss.px4.io/t/mavsdk-integration-with-yuneec-mantis-q/11960/4 "2019-07-22T14:06:28Z")

</div>

I have a USB WiFi adapter that uses the 5GHz band. The Link and IP layers should be fine because I can ping the drone at 192.168.42.1. And from the behavior I’ve seen with QGroundControl as well as the drone’s webpage access the UDP and TCP Transport layer seem fine too

---

<div class="post-metadata">

**Author:** ![JulianOes](https://discuss.px4.io/user_avatar/discuss.px4.io/julianoes/32/30_2.png) [@JulianOes](https://discuss.px4.io/u/JulianOes)\
**Post date:** [July 22, 2019, 2:25pm UTC](https://discuss.px4.io/t/mavsdk-integration-with-yuneec-mantis-q/11960/5 "2019-07-22T14:25:39Z")

</div>

Ok there is the chance that no heartbeat from the autopilot is forwarded.

Therefore, you could try to remove the check for `has_autopilot()` and just try to continue with the script without that.

---

<div class="post-metadata">

**Author:** ![mburgund](https://discuss.px4.io/user_avatar/discuss.px4.io/mburgund/32/4008_2.png) [@mburgund](https://discuss.px4.io/u/mburgund)\
**Post date:** [July 22, 2019, 3:48pm UTC](https://discuss.px4.io/t/mavsdk-integration-with-yuneec-mantis-q/11960/6 "2019-07-22T15:48:44Z")

</div>

As far as I can tell, the example version I’m using (Dronecode SDK v0.17.0) doesn’t include a check for has\_autopilot(). I suppose it could be included as a part of this check for discovered\_system, and we could just ignore the “return 1;” line. I’ll give it a shot.

> // We don’t need to specify the UUID if it’s only one system anyway.  
> // If there were multiple, we could specify it with:  
> // dc.system(uint64\_t uuid);  
> System &system = dc.system();
> 
> std::cout \<\< “Waiting to discover system…” \<\< std::endl;  
> dc.register\_on\_discover([&discovered\_system](uint64\_t uuid) {  
> std::cout \<\< "Discovered system with UUID: " \<\< uuid \<\< std::endl;  
> discovered\_system = true;  
> });
> 
> // We usually receive heartbeats at 1Hz, therefore we should find a system after around 2  
> // seconds.  
> sleep\_for(seconds(2));
> 
> if (!discovered\_system) {  
> std::cout \<\< ERROR\_CONSOLE\_TEXT \<\< “No system found, exiting.” \<\< NORMAL\_CONSOLE\_TEXT  
> \<\< std::endl;  
> return 1; // **comment out this line, live dangerously**  
> }

---

<div class="post-metadata">

**Author:** ![mburgund](https://discuss.px4.io/user_avatar/discuss.px4.io/mburgund/32/4008_2.png) [@mburgund](https://discuss.px4.io/u/mburgund)\
**Post date:** [July 22, 2019, 5:21pm UTC](https://discuss.px4.io/t/mavsdk-integration-with-yuneec-mantis-q/11960/7 "2019-07-22T17:21:27Z")

</div>

So I removed the exit condition and extended the wait time to find a system to 5 seconds. Now after the waiting period it continues and in the component callback, finally discovers the autopilot. But now it looks like it’s exhibiting the behavior I saw with QGroundControl, where it always automatically disarms itself (though this way the rotors still don’t even spin)

> user@CUSTOM-CONTROLLER-NAME:/path/to/demo$ ./takeoff\_and\_land udp://192.168.42.6:14550  
> [01:01:03|Info] DronecodeSDK version: 0.17.0 (dronecode\_sdk\_impl.cpp:25)  
> [01:01:03|Debug] New: System ID: 0 Comp ID: 0 (dronecode\_sdk\_impl.cpp:338)  
> Waiting to discover system…  
> [01:01:03|Info] New system on: 192.168.42.1:14551 (udp\_connection.cpp:226)  
> [01:01:03|Debug] Component Camera 1 (100) added. (system\_impl.cpp:400)  
> No system found, but continuing in case it doesn’t want to report autopilot heartbeats.  
> Discovered a component with type 2  
> [01:01:08|Debug] Component Autopilot (1) added. (system\_impl.cpp:400)  
> Discovered a component with type 1  
> Vehicle is getting ready to arm  
> [01:01:08|Debug] Discovered 2 component(s) (UUID: 1900593) (system\_impl.cpp:563)  
> Discovered system with UUID: 1900593  
> [01:01:09|Debug] MAVLink: info: [logger] file: /fs/microsd/log/sess050/log001.ulg (system\_impl.cpp:307)  
> [01:01:09|Debug] MAVLink: info: Disarmed by init → standby (system\_impl.cpp:307)  
> [01:01:09|Debug] MAVLink: info: (3,27)FUSE OPTICAL FLOW (system\_impl.cpp:307)  
> Vehicle is getting ready to arm  
> [01:01:10|Debug] MAVLink: critical: no-fly zone unlock status:0 1 0 (system\_impl.cpp:307)  
> Vehicle is getting ready to arm  
> Vehicle is getting ready to arm  
> Vehicle is getting ready to arm  
> Vehicle is getting ready to arm  
> Vehicle is getting ready to arm  
> Vehicle is getting ready to arm  
> Vehicle is getting ready to arm  
> Vehicle is getting ready to arm  
> Vehicle is getting ready to arm  
> Vehicle is getting ready to arm  
> Vehicle is getting ready to arm  
> Vehicle is getting ready to arm  
> ^C

---

<div class="post-metadata">

**Author:** ![mburgund](https://discuss.px4.io/user_avatar/discuss.px4.io/mburgund/32/4008_2.png) [@mburgund](https://discuss.px4.io/u/mburgund)\
**Post date:** [July 22, 2019, 6:50pm UTC](https://discuss.px4.io/t/mavsdk-integration-with-yuneec-mantis-q/11960/8 "2019-07-22T18:50:23Z")

</div>

I think there’s some extra component with type 2 that’s on there, since 1 is the autopilot and 100 is the camera. That might be something going on that’s causing this. maybe I have to direct messages to that component as well to handle any special settings?

---

<div class="post-metadata">

**Author:** ![JulianOes](https://discuss.px4.io/user_avatar/discuss.px4.io/julianoes/32/30_2.png) [@JulianOes](https://discuss.px4.io/u/JulianOes)\
**Post date:** [July 23, 2019, 7:18am UTC](https://discuss.px4.io/t/mavsdk-integration-with-yuneec-mantis-q/11960/9 "2019-07-23T07:18:12Z")

</div>

Looks like you were able to arm but then it auto-disarms because of a no-fly zone lock. I guess that’s one of the custom things on Mantis which makes it non-standard PX4. I’d recommend to talk to someone from Yuneec to find out more.

---

<div class="post-metadata">

**Author:** ![mburgund](https://discuss.px4.io/user_avatar/discuss.px4.io/mburgund/32/4008_2.png) [@mburgund](https://discuss.px4.io/u/mburgund)\
**Post date:** [July 23, 2019, 12:40pm UTC](https://discuss.px4.io/t/mavsdk-integration-with-yuneec-mantis-q/11960/10 "2019-07-23T12:40:40Z")

</div>

For posterity: according to [@xdw](https://px4.slack.com/team/U832WC68P) in a direct message, “Sorry, this consumer product [Mantis Q] does not support sdk development, so I can’t continue to help. You can pay attention to yuneec’s industrial-grade products, where we will re-support sdk development.”

---

<div class="post-metadata">

**Author:** ![mburgund](https://discuss.px4.io/user_avatar/discuss.px4.io/mburgund/32/4008_2.png) [@mburgund](https://discuss.px4.io/u/mburgund)\
**Post date:** [July 23, 2019, 12:45pm UTC](https://discuss.px4.io/t/mavsdk-integration-with-yuneec-mantis-q/11960/11 "2019-07-23T12:45:40Z")

</div>

So it seems that Mantis Q does not support Mavlink or MAVSDK. If one wants a Yuneec product that may support Mavlink, then one should buy an industrial unit. Unfortunately for the amount of time and budget I have remaining on this project, that option is infeasible
