Controlling Parrot drones using SkyController2

Hey, it’s been some time I’m writing a new RC software to run on the Parrot SkyController2 to use with ArduPilot on the supported drones from Parrot. The video above is the current progress. End goal is to control the Parrot Disco fixed wing, but on my travel to Brazil unfortunately it didn’t fit in my bags. So, in order to test the RC implementation I revived an old Bebop 1 I had. The project I’m talking about is called dema-rc and can be found on my github: https://github.com/lucasdemarchi/dema-rc.

The SkyController2, like the drones from Parrot use a custom Linux distro with influences from buildroot and Android. It has its own init system and it’s very streamed down. On SkyController2 for example you don’t have much space left, just a few megabytes. I made a blog post last year about the technical details of side-loading our own software on these kind of Linux boards: https://politreco.com/2019/09/side-load-on-embedded-linux-with-buildroot/. I see lots of projects just building the software statically to overcome dependencies issues, but I believe this is a better approach. Since that blog post I automated the way I build the software, integrating with Gitlab-CI, and making the toolchain available as a docker container (it’s available in my registry on Gitlab, registry.gitlab.com/lucas.de.marchi/dema-rc/armv7hf, but you can also just build your own with the Dockerfile. That container has all the dependencies to build the software plus the rootfs we use for side-loading additional software.

Once you have the toolchain, just configure and build dema-rc (in the case below I installed the toolchain under /opt/):

$ meson setup --cross-file /opt/arm-buildroot-linux-gnueabihf_sdk-buildroot/etc/meson/cross-compilation.conf build-armv7
$ ninja -C build-armv7

You also need bleeding edge version of ArduPilot running, containing this PR: https://github.com/ArduPilot/ardupilot/pull/13607

The best way I found to connect my computer to the Skycontroller2 is to find a compatible usb-ethernet dongle and connect it to the only USB port. Just a few dongles work out of the box, namely the ones that are USB 2.0 10/100 and use the asix chip. The Gigabit and/or USB 3.0 don’t work, even if they have the asix chip. This is the one I bought: https://www.amazon.com/gp/product/B00MYT481C/ref=ppx_yo_dt_b_search_asin_title?ie=UTF8&psc=1

It’s also possible to connect to the SK2 by hoping through the drone if they are running the original flight stack (otherwise it will keep disconnecting). You will need to discover the IP the controller was assigned and also have adb server on the drone. I think using the usb-ethernet is much simpler, more reliable and in future will allow you to feed the GCS with mavlink data and video (this is currently not working). Once you have it connected, to your computer, then you just need adb on your computer:

$ adb connect 192.168.53.1:9050
$ adb shell

This gets you logged in the SkyController2. All the configuration files and scripts you need are in this directory: https://github.com/lucasdemarchi/dema-rc/tree/master/distro/skycontroller2. Copy them using the install.sh script on the same directory. Next you will have to push dema-rc (and dependent libraries) you just built to /data/ftp/internal_000/ardupilot/bin/. See the install.sh script to check the commands to use.

After installing you have to reboot the SkyController2 using the power button. When it powers up again, it will still be using the original software. You have to press the “settings” button so it switches to dema-rc. After that you should see a blue LED blinking rather than a red one when it’s trying to find the drone’s network. The LED stays solid blue when connected. Differently from the original software, it doesn’t matter if the flight stack is running on the other side, it will try to connect (and reconnect in case the network connection is lost) to the SSID configured in /data/ftp/internal_000/ardupilot/bin/dema-rc.

Some limitations of the software in the current state:

  • Buttons are momentary only, so ArduPilot does not parse them correctly. This will be fixed soon by allowing buttons to be configured to toggle min/max when pressed

  • We don’t support local actions on buttons, so we can’t shutdown the controller. Current workaround is to switch back to the original software (by pressing the settings button) and then shut it down.

  • Installation involves a manual process as noted above. In future this will be simplified by packages with auto-extracting script.

  • GCS needs to be connected via its own wifi rather than routing through the SkyController.

6 Likes

Awesome work! Will be really great to use the SkyController2 with ArduPilot and the Parrot Disco. Any chance you will also integrate it to work with the Disco4g (softmod)?

It should be 99% compatible with the disco4g mod. The problems I can imagine are:

  • They directly start/stop the original software stack running on the controller (mppd) to handle the wifi connection. That will need to change.

  • handling the button to switch wifi/4g currently conflicts. I plan to add “local” actions that can be configured. That should solve this problem.

I don’t have a 4g modem to try it now, but maybe in future.

Great work ! Could we have telemetry from usb at this time (otherwise is it planned ?) ?

I plan to add telemetry via the usb-ethernet dongle.

2 Likes

Really great work! I’d love to be able to load ArduPilot on a Bebop2 (which we can already do) and then control it using the SkyController2 especially if the video was also working.

Here in Japan we suffer from a very very limited range of telemetry and live video systems. The Bebop2 and SkyController2 are one of the few systems that are certified for use here.

1 Like

@rmackay9 thanks. I think what I have for bebop 1 applies on bebop2, but I’m not entirely sure. I’m working on some instructions to get it working, could you test on bebop2?

@patrickelectric I see you worked on GCS for parrot drones… do you know what command I have to use to start/stop video there? Do we also have the media-ctl command we use in Disco?

Hi @lucasdemarchi,

You can use the MediaRecord class with the command Video.
This is done by Kirogi here:

how can I build with the not-yet-pulled PR that is required?
once it’s in I assume that “./waf configure --board=disco --static && ./waf build” will do the job.

@Andre-K yes, that’s right. IMO the right thing to do is to get ardupilot using the same toolchain and merge this patch. Then you can simply download it from ardupilot’s server.

@tridge2 if I create the hooks in CI to build ardupilot, could I upload the result to ardupilot’s server? Or would it be better to install the same toolchain in our builder machine?

@tridge ^ … I guess I tagged the wrong person. Another option that may be even better is to build our toolchain on ardupilot’s repo. We could 1) use the same configuration that I have in dema-rc, adding gitlab-ci in addition to travis/semaphore/etc, 2) integrate the toolchaing building in the current CIs (I don’t know how); 3) setup github actions - I have a vague idea how. Then we’d add an action/pipeline to the CI to upload the result to firmware.ardupilot.org. What do you think?

1 Like

@lucasdemarchi
I have documented my attempt here:

There are signs that SC2 & Disco do talk, but it does not seem like arduplane is running.

1 Like

The install process gets more and more streamlined and user-friendly for each day lately.
RC Failsafe works fine, lots of buttons are accessible to arduplane.

Noe to all; should you see “temp reset” in console and AHI go wild, then you are running two ardupilots simultaneously on the chuck.

@Andre-K thanks for your support and tests. I added a quick documentation for other to be able to reproduce it as you did. Hopefully this will attract more users. See https://lucasdemarchi.github.io/dema-rc/

Here is the log from my first test flight:
https://drive.google.com/file/d/1RfdM8UY54fzJ1YC5D-DtumF8H9HL4fGX/view?usp=sharing

I had (unexperienced) assistance with throwing … the first throw (around 640seconds into the log)was bad, but the Disco were simply too slow to put wings level and climb, hit the high grass as intended in case of any problems.

The second throw was better, Disco oscillated for a while, then settled and flew fine.
Some observations:
1: it slowly lost altitude during “level flight” with no input in FBWA
2: I did try FBWB - flew fine…
3: RC protocol is logged as “unknown” :slight_smile:
4: Full roll is much steeper in FBWB than FBWA

Finally, I decided to do a go-around , and did increase throttle quickly from 0% , the motor moved for less than a second, the started to beep like the Disco “motor error” does in case of overload/stuck propeller. I guess the ESC is still protected, and throttle needs to be increased softly from 0%.

The flight was a success, I wish there were an option top pan/tilt the camera and change exposure.

Offline at this time …

I finally get my rj45 to usb adapter, successfully connected to SC2

How could it be attract some users !!! … Nothing clean to install for the end user !

  • 2 repos containing same files, where to look … Gitlab or github or both …?!
  • Install is tricky and users with zero knowledge with linux will not definitvely don’t understand some steps
  • SC2 has ftp too
  • no out of the box working arduplane (no pre built binaries) if we follow this markdown : dema-rc/docs/install-ardupilot.md at master · ArduPilot/dema-rc · GitHub
  • Parrot firmware used should be mention to avoid some mistakes

So finally, led is solid blue but Qgroundcontrol or mission planner does not connect on 192.168.53.1:14550 with arduplane 3.9.1 fw. I can connect directly to chuck with wifi and both QGC and MP works fine in this configuration but not through SC2

Is this compatible with any arduplane version ? Is there a way to check in SC2 if we are really connected to chuck ?

4.0.4 thankfully provided by AndreK report errors :

# LD_LIBRARY_PATH=/data/ftp/internal_000/ardupi
lot/lib \
>     /data/ftp/internal_000/ardupilot/arduplane  \
>         -A udp:192.168.42.255:14550:bcast \
>         -B /dev/ttyPA1 \
>         -C udp:192.168.43.255:14550:bcast
/data/ftp/internal_000/ardupilot/arduplane: /lib/libm.so.6: version `GLIBC_2.27' not found (required by /data/ftp/internal_000/ardupilot/arduplane)
/data/ftp/internal_000/ardupilot/arduplane: /lib/libc.so.6: version `GLIBC_2.28' not found (required by /data/ftp/internal_000/ardupilot/arduplane)

Official 4.0.5 fail as well :

# LD_LIBRARY_PATH=/data/ftp/internal_000/ardupilot/lib /data/ftp/internal_000/ardupilot/arduplane -A udp:192.168.42.255:14550:bcast -B /dev/ttyPA1 -C udp:192.168.43.255:14550:bcast
/data/ftp/internal_000/ardupilot/arduplane: /lib/libm.so.6: version `GLIBC_2.27' not found (required by /data/ftp/internal_000/ardupilot/arduplane)

Repo moved to ardupilot org, so did the doc website with installation instructions:
https://ardupilot.github.io/dema-rc/

There I do point to prebuilt binaries. Arduplane you can get from ardupilot site.

I’ll check and I’ll report here, thank you Lucas

Ok so it’s markdown files presented by mkdocs. So no more luck… I used them today.

We need some more info :

  • Which Parrot firmware to use : 1.3, 1.6, 1.7 ?
  • What is the status with arduplane builds regarding Disco and libraries ? I remember a post where you state about toolchain but It is old now … what about now ?
  • Is there a command to check connection to disco ? Which protocol is this ? Mavlink ?

Thanks

It was tested with latest firmwares for Disco and Bebop and SkyController2. It should work with other versions too, but it’s recommended to upgrade to the latest ones.

The RC functionality should work the same regardless of additional libraries for Disco. I thought the binary in ardupilot’s server was statically compiled, but that is only true for bebop, not for disco. From your errors it seems you are using a dynamic-linked binary for Ardupilot and it’s failing to start due to incompatible libraries. For now people will have to compile Ardupilot themselves. You can use the same toolchain used to build dema-rc. You can also use the same binary you are using and copy the additional libraries off the toolchain.

The sticks and buttons from SkyController2 are sent to Ardupilot via their own basic protocol (like if it was DSM/SBUS/etc). SkyController2 also connects to Ardupilot via mavlink and forwards those packets to whatever is connected on the USB.