Controlling Parrot drones using SkyController2

That’s why i asked which parrot firmware are you running ? Because I didn’t do anything with libraries, and I guess parot upgrade libraries with firmware …
What I notice is that :

  • ardupilot is working with 3.9.1 version which was available on ardupilot server,
  • newest one don’t work due to library error : it was not built with same libraries version,
  • What is surprising is why @Andre-K version doesn’t work on my Disco whereas it works for him …

I get your point that I have to build myself (I never built Disco fw but for pixhawk yes) but if it’s not the same libraries that ones present on Disco, how could it work ?!

He copied the additional libraries from the toolchain to disco. See that we start arduplane and set the env var LD_LIBRARY_PATH=/data/ftp/internal_000/ardupilot/lib

That means you can put additional libraries there. All the libraries you need should be inside the toolchain I provided.

For dema-rc running on Skycontroller2 I integrated it with he build system so it’s done automatically. I didn’t have time to do the same for arduplane though. I may do it soon, but I’m pretty swamped with other stuff so may not have time.

Ok, but even with lib copied from toolchain, same error ^^ I will build myself later … I stay with 3.9.1 at this time

You copy a simlink in your doc, even if it seems to copy the symlinked library, could be better …

$ ls -lha libserialport.*
-rwxr-xr-x 1 sylvain sylvain 1023  9 mai   14:11 libserialport.la
lrwxrwxrwx 1 sylvain sylvain   22  9 mai   14:03 libserialport.so -> libserialport.so.0.1.0
lrwxrwxrwx 1 sylvain sylvain   22  9 mai   14:03 libserialport.so.0 -> libserialport.so.0.1.0
-rwxr-xr-x 1 sylvain sylvain  73K  9 mai   14:03 libserialport.so.0.1.0

So in my case SC2 doesn’t route network to disco. Netstat report from SC2

# netstat -tulpn | grep LISTEN
tcp        0      0 0.0.0.0:21              0.0.0.0:*               LISTEN      50/inetd 

How to they route network in SC2 ? Iptables is available but no tables initialized

Connected directly to Disco with mission planner and udp connection, any SC2 input has no channel value modification in status tab. I can ping SC2 from Disco, so connection seems Ok, but not mavlink routing

Netstat is more verbose on Disco :

# netstat 
Active Internet connections (w/o servers)
Proto Recv-Q Send-Q Local Address           Foreign Address         State       
tcp        0     82 192.168.42.1:23         192.168.42.21:59649     ESTABLISHED 
tcp        0      0 192.168.42.1:23         192.168.42.74:48972     ESTABLISHED 
udp        0  18304 192.168.42.1:55589      192.168.42.74:14550     ESTABLISHED 
Active UNIX domain sockets (w/o servers)
Proto RefCnt Flags       Type       State         I-Node Path
unix  2      [ ]         STREAM                     6708 /var/run/lttng/ustconsumerd64/error
unix  2      [ ]         STREAM                     6711 /var/run/lttng/ustconsumerd32/error
unix  2      [ ]         DGRAM                      1304 @/org/kernel/udev/udevd-juba
unix  2      [ ]         DGRAM                      1309 @/org/parrot/jubamountd
unix  2      [ ]         STREAM                     1928 /var/run/lttng/kconsumerd/error
unix  2      [ ]         DGRAM                      1307 @/org/kernel/udev/juba-provider-device
unix  3      [ ]         STREAM     CONNECTED       7394 
unix  3      [ ]         STREAM     CONNECTED       7393 
unix  3      [ ]         STREAM     CONNECTED       6730 /var/run/lttng/lttng-ust-sock-6
unix  3      [ ]         STREAM     CONNECTED       6729 
unix  3      [ ]         STREAM     CONNECTED       7389 /var/run/lttng/lttng-ust-sock-6
unix  3      [ ]         STREAM     CONNECTED       6728 
unix  3      [ ]         STREAM     CONNECTED       6406 
unix  3      [ ]         STREAM     CONNECTED       6405 
unix  3      [ ]         STREAM     CONNECTED       1910 
unix  3      [ ]         STREAM     CONNECTED       1909 
unix  3      [ ]         STREAM     CONNECTED       1330 
unix  3      [ ]         STREAM     CONNECTED       1329 
unix  3      [ ]         DGRAM                      1315 
unix  3      [ ]         DGRAM                      1314 
unix  3      [ ]         STREAM     CONNECTED       1327 @/org/kernel/udev/juba-provider-server
unix  3      [ ]         STREAM     CONNECTED       1311 
unix  2      [ ]         DGRAM                      1310 
unix  3      [ ]         STREAM     CONNECTED       5832 
unix  3      [ ]         STREAM     CONNECTED       5831 

Still not a success at this time …

but 3.9.1 doesn’t have the support needed on the ardupilot side to support more than 8 channels.

These are the commands to build arduplane:

export PATH=/opt/arm-buildroot-linux-gnueabihf_sdk-buildroot/bin/:$PATH
./waf configure --board disco
./waf plane

Check needed libraries:

$ arm-linux-gnu-readelf -d build/disco/bin/arduplane  | grep NEEDED
 0x00000001 (NEEDED)                     Shared library: [libdl.so.2]
 0x00000001 (NEEDED)                     Shared library: [libiio.so.0]
 0x00000001 (NEEDED)                     Shared library: [libstdc++.so.6]
 0x00000001 (NEEDED)                     Shared library: [libm.so.6]
 0x00000001 (NEEDED)                     Shared library: [libgcc_s.so.1]
 0x00000001 (NEEDED)                     Shared library: [libpthread.so.0]
 0x00000001 (NEEDED)                     Shared library: [libc.so.6]

All these libraries should be available inside the toolchain (more specifically in the sysroot):

$ find  /opt/arm-buildroot-linux-gnueabihf_sdk-buildroot/arm-buildroot-linux-gnueabihf/sysroot/ -name libdl.so.2 -o -name libiio.so.0 -o -name libstdc++.so.6 -o -name libm.so.6 -o -name libgcc_s.so.1 -o -name libpthread.so.0 -o -name libc.so.6
/opt/arm-buildroot-linux-gnueabihf_sdk-buildroot/arm-buildroot-linux-gnueabihf/sysroot/usr/lib/libiio.so.0
/opt/arm-buildroot-linux-gnueabihf_sdk-buildroot/arm-buildroot-linux-gnueabihf/sysroot/lib/libgcc_s.so.1
/opt/arm-buildroot-linux-gnueabihf_sdk-buildroot/arm-buildroot-linux-gnueabihf/sysroot/lib/libdl.so.2
/opt/arm-buildroot-linux-gnueabihf_sdk-buildroot/arm-buildroot-linux-gnueabihf/sysroot/lib/libm.so.6
/opt/arm-buildroot-linux-gnueabihf_sdk-buildroot/arm-buildroot-linux-gnueabihf/sysroot/lib/libc.so.6
/opt/arm-buildroot-linux-gnueabihf_sdk-buildroot/arm-buildroot-linux-gnueabihf/sysroot/lib/debug/libstdc++.so.6
/opt/arm-buildroot-linux-gnueabihf_sdk-buildroot/arm-buildroot-linux-gnueabihf/sysroot/lib/libpthread.so.0
/opt/arm-buildroot-linux-gnueabihf_sdk-buildroot/arm-buildroot-linux-gnueabihf/sysroot/lib/libstdc++.so.6

Probably because arduplane is not actually running on Disco. Once we discover the GCS IP we start forwarding the port 14550 from one interface (wlan0) to the other (eth0) via iptables. See dema-rc/distro/sc2/usr/bin/dema-rc-cm at master · ArduPilot/dema-rc · GitHub

On the GCS side you have to configure it to use udpin and to connect to ardupilot. On QGS that means simply inputing the IP 192.168.53.1. See Send telemetry over usb-ethernet on SkyController2 · Issue #4 · ArduPilot/dema-rc · GitHub - that is missing from the docs. It was not my original intention to use udpin, but it was the most reliable way to configure it I could find.

You won’t see anything in netstat as there isn’t a program listening/sending/receiving on that port. It’s simply routed by the kernel. You can use iptables to monitor the traffic:
tcpdump -n -p udp -i eth0 port 14550 to check if the GCS is trying to connect.

Actually it’s the video that is forwarded from Disco to GCS. For mavlink data we don’t need to know the GCS IP and should happen as soon as you have a solid blue LED. Check with iptables-save command to check if the tables are initialized.

Arduplane was running on 3.9.1 as I use Disco with Wifi and sbus rc …

Ok so I built it. For those who want arduplane binary for Disco : freshly build 4.0.5 available here >
https://drive.google.com/drive/folders/1uVnsX2uYeHUKklSbyLPJjkFdLChK8MjE?usp=sharing
For missing libraries, you should take one present in Lucas Demarchi toolchain and put them in /data/ftp/internal_000/ardupilot/lib/

Still no luck communicating between SC2 and Disco, something is missing. MP or QGC configuration ok. SC2 iptables-save :

# iptables-save 
# Generated by iptables-save v1.4.21 on Sun Jul  5 00:16:25 2020
*nat
:PREROUTING ACCEPT [1:163]
:INPUT ACCEPT [1:163]
:OUTPUT ACCEPT [7:420]
:POSTROUTING ACCEPT [7:420]
-A PREROUTING -p udp -m udp --dport 14550 -j DNAT --to-destination 192.168.42.1
-A POSTROUTING -p udp -m udp --dport 14550 -j MASQUERADE
COMMIT
# Completed on Sun Jul  5 00:16:25 2020

In Disco I changed start_ardupilot.sh command to :
./arduplane -A udpin:0.0.0.0:14550:bcast -B /dev/ttyPA1 -C udp:192.168.43.255:14550:bcast --module-directory modules

Complete start_ardupilot.sh script is available with link above

Now monitor tcpdump during GCS connection =>

 # tcpdump -n -p udp -i eth0 port 14550
tcpdump: verbose output suppressed, use -v or -vv for full protocol decode
listening on eth0, link-type EN10MB (Ethernet), capture size 65535 bytes
00:42:07.734171 IP 192.168.53.67.41922 > 192.168.53.1.14550: UDP, length 14
00:42:07.734277 IP 192.168.53.67.41922 > 192.168.53.1.14550: UDP, length 14
00:42:07.736030 IP 192.168.53.67.41922 > 192.168.53.1.14550: UDP, length 14
00:42:07.737665 IP 192.168.53.67.41922 > 192.168.53.1.14550: UDP, length 14
00:42:07.739271 IP 192.168.53.67.41922 > 192.168.53.1.14550: UDP, length 14
00:42:07.741280 IP 192.168.53.67.41922 > 192.168.53.1.14550: UDP, length 14
00:42:07.743277 IP 192.168.53.67.41922 > 192.168.53.1.14550: UDP, length 14
00:42:07.745036 IP 192.168.53.67.41922 > 192.168.53.1.14550: UDP, length 14
00:42:07.745088 IP 192.168.53.67.41922 > 192.168.53.1.14550: UDP, length 14

And then it stop, GCS could not connect …

Edit : Additional note : I could connect to Disco with adb shell inside SC2 through telnet protocol so it means connection between SC2 and Disco is OK

Disco iptables-save

# iptables-save 
# Generated by iptables-save v1.4.21 on Sun Jul  5 01:13:20 2020
*nat
:PREROUTING ACCEPT [1:163]
:INPUT ACCEPT [1:163]
:OUTPUT ACCEPT [7:420]
:POSTROUTING ACCEPT [0:0]
-A PREROUTING -p udp -m udp --dport 14550 -j DNAT --to-destination 192.168.42.1
-A PREROUTING -p tcp -m tcp --dport 14550 -j DNAT --to-destination 192.168.42.1:14550
-A PREROUTING -s 192.168.53.0/24 -p tcp -m tcp --dport 14550 -j DNAT --to-destination 192.168.42.1:14550
-A POSTROUTING -p udp -m udp --dport 14550 -j MASQUERADE
-A POSTROUTING -j MASQUERADE
COMMIT
# Completed on Sun Jul  5 01:13:20 2020

@lucasdemarchi : is there a routine to start before all complete stack will be ok ,
I mean, is it necessary to start ardupilot or dema-rc before one :

  • Start SC2
  • Switch SC2 to dema-rc
  • Start Disco
  • Press 3 times
  • Connect with QGC or MP through SC2

I don’t understand why it doesn’t work … iptables routing seems ok

Any startup order should be fine.

Did you check ardupilot is running on Disco?

ps aux | grep arduplane

Ok …
I can connect directly using mp or qgc with disco wifi so it run ardupilot of course.
Thank you for your reply, any other idea may be ?

Remove the :bcast from udpin:

On Disco: change start arguments to: -A udpin:0.0.0.0:14550 -B /dev/ttyPA1 …

On GCS: set it to use udpin, configuring the IP to 192.168.53.1.

Also, let me prepare some prebuilt binaries for you

Ok thank you. Does it seem ok ?:

/ # ps
  PID USER       VSZ STAT COMMAND
    1 root      3396 S    /sbin/init
    2 root         0 SW   [kthreadd]
    3 root         0 SW   [ksoftirqd/0]
    4 root         0 SW   [kworker/0:0]
    5 root         0 SW   [kworker/u:0]
    6 root         0 SW   [migration/0]
    7 root         0 SW   [watchdog/0]
    8 root         0 SW   [migration/1]
    9 root         0 SW   [kworker/1:0]
   10 root         0 SW   [ksoftirqd/1]
   11 root         0 SW   [watchdog/1]
   12 root         0 SW<  [khelper]
   13 root         0 SW   [kdevtmpfs]
   14 root         0 SW<  [netns]
   15 root         0 SW   [irq/1-p7mu]
   16 root         0 SW   [sync_supers]
   17 root         0 SW   [bdi-default]
   18 root         0 SW<  [kblockd]
   19 root         0 SW   [khubd]
   20 root         0 SW<  [rpciod]
   21 root         0 SW   [kworker/0:1]
   22 root         0 SW   [khungtaskd]
   23 root         0 SW   [kswapd0]
   24 root         0 SW   [fsnotify_mark]
   25 root         0 SW<  [nfsiod]
   26 root         0 SW<  [cifsiod]
   27 root         0 SW<  [crypto]
   37 root         0 SW   [ubi_bgt0d]
   38 root         0 SW<  [ci_otg]
   39 root         0 SW<  [ci_otg]
   40 root         0 SW<  [f_mtp]
   41 root         0 SW   [file-storage]
   42 root         0 SW   [kworker/1:1]
   43 root         0 SW   [irq/44-mmc0]
   44 root         0 SW   [kworker/u:1]
   45 root         0 SW<  [deferwq]
   46 root         0 SW   [kworker/u:2]
   47 root         0 SW   [mmcqd/0]
   48 root         0 SW   [mmcqd/0boot0]
   49 root         0 SW   [mmcqd/0boot1]
   50 root         0 SW   [jbd2/mmcblk0p3-]
   51 root         0 SW<  [ext4-dio-unwrit]
   56 root         0 SW   [mt9f002 0-0010]
   61 root         0 SW   [spi1]
   62 root         0 SW   [mali_rt]
   63 root         0 SW   [jbd2/mmcblk0p5-]
   64 root         0 SW<  [ext4-dio-unwrit]
   65 root         0 SW   [jbd2/mmcblk0p4-]
   66 root         0 SW<  [ext4-dio-unwrit]
   68 root      3728 S    {rcS} /bin/sh /etc/init.d/rcS
   69 root      3836 S    /usr/bin/shpoison
   70 root      4016 S <  /usr/bin/udevd
   71 root      3908 S    /usr/bin/jubamountd
   76 root      4692 S    /usr/bin/ledd-ng
   77 root      3968 S    /usr/bin/crashdumpd
   78 root      6340 S    /usr/bin/plf_updater
   79 root      4664 S    /usr/bin/sqcd
   80 root      3204 S    /usr/bin/kmsgd
   81 root      3796 S    /usr/bin/rsync --daemon --no-detach --config /etc/rsyncd.conf
  100 root      4012 S <  /usr/bin/udevd
  102 root      4012 S <  /usr/bin/udevd
  122 root         0 SW<  [usb-thread]
  125 root         0 SW<  [wl-thread]
  134 root         0 SW   [kworker/0:2]
  136 nobody    3904 S    /usr/sbin/dnsmasq --keep-in-foreground --port=0 --conf-file=/var/run/dnsmasq/dnsmasq.conf.eth0
  138 root      3280 S    /usr/bin/gpio_monitor /sys/devices/platform/user_gpio/USER_ON_OFF /bin/onoffbutton
  157 root         0 SW   [flush-179:0]
  265 root      3728 S    {rcS} /bin/sh /etc/init.d/rcS
  267 root      3712 S    /usr/bin/ujubaclient
  268 root      3192 S    ulogger -t ujubaclient -p I
  305 root         0 SW   [jbd2/mmcblk0p6-]
  306 root         0 SW<  [ext4-dio-unwrit]
  319 root      3248 S    /usr/bin/ptpd
  330 root      5328 S    /usr/bin/macgyverd
  339 root      4684 S    ephemerisd /data/ftp/internal_000/gps_data/ephemeris.bin
  347 root      3796 S    /usr/sbin/inetd -f
  350 root      4548 S    avahi-daemon: running [DISCO-008895.local]
  421 root         0 SW   [kworker/1:2]
 1043 root      3592 S    ulogcat -uk -v ckcm
 1058 root      3192 S    /usr/bin/bcm-watchdog
 1061 root      3724 S    {rcS_mode_defaul} /bin/sh /etc/init.d/rcS_mode_default
 1063 root      3724 S    {start_ardupilot} /bin/sh /data/ftp/internal_000/ardupilot/start_ardupilot.sh
 1064 root      3724 S    {start_ardupilot} /bin/sh /data/ftp/internal_000/ardupilot/start_ardupilot.sh
 1067 root      3724 S    {dragon_ipc.sh} /bin/sh /bin/dragon_ipc.sh dragon_shutdown
 1069 root      3416 S    pomp-cli unix:@/com/parrot/dragon_ipc 0  0
 1081 root     11420 S    /usr/bin/adbd
 1083 root      4160 S    /usr/sbin/telnetd -F -l /bin/login.sh
 1084 root     22248 S    /usr/bin/lttngd
 1085 root     92080 S    /usr/bin/lttng-sessiond
 1089 root      3724 S    udhcpd /etc/udhcpd.conf.rndis0
 1094 root      6504 S    lttng-runas
 1197 root      4160 S    /bin/sh -l
 1201 root      4160 R    ps
 # cat /data/ftp/internal_000/ardupilot/start_ardupilot.sh | grep arduplane
    echo "$(date) Starting arduplane"
    ./arduplane -A udpin:0.0.0.0:14550 -B /dev/ttyPA1 -C udp:192.168.43.255:14550:bcast --module-directory modules

udpin disappear in ps ! Could be the expected behaviour as ip looks ok

Disco start in manual I guess (or should it switch directly in rtl ?), so I think I can move elevons through sc2 which is the not the case at this time …

I built release 4.0.6 and available here :

https://drive.google.com/drive/folders/13eN89fqVqHZvaE1SmOCd7sOZRn0KlYee?usp=sharing

Still no luck for me to connect through SC2 but with direct connection to Disco Wifi it’s ok : QGC and Mission Planner … No more idea ?

@lucasdemarchi Mind you share your :

  • content of /etc/init.d/rcS_mode_default
  • do you use start_ardupilot.sh, if yes could you please share
  • Could I have your iptables-save in SC2 and Disco ?

Im trying to build latest Arduplane release with supplied buildroot - but missing something obvious - as libiio is not found by configure:

./waf configure --board disco
Setting top to : /opt/ardupilot
Setting out to : /opt/ardupilot/build
Autoconfiguration : enabled
Setting board to : disco
Using toolchain : arm-linux-gnueabihf
Checking for ‘g++’ (C++ compiler) : /opt/arm-buildroot-linux-gnueabihf_sdk-buildroot/bin/arm-linux-gnueabihf-g++
Checking for ‘gcc’ (C compiler) : /opt/arm-buildroot-linux-gnueabihf_sdk-buildroot/bin/arm-linux-gnueabihf-gcc
Checking for c flags ‘-MMD’ : yes
Checking for cxx flags ‘-MMD’ : yes
Checking for need to link with librt : not necessary
Checking for ‘lttng-ust’: : disabled
Checking for library dl : yes
Checking for program ‘arm-linux-gnueabihf-pkg-config’ : /usr/bin/arm-linux-gnueabihf-pkg-config
Checking for ‘libiio’ : not found

libiio itself exists in buildroot:
ls -l /opt/arm-buildroot-linux-gnueabihf_sdk-buildroot/arm-buildroot-linux-gnueabihf/sysroot/usr/lib/libiio.so.0
lrwxrwxrwx 1 root root 14 May 9 10:04 /opt/arm-buildroot-linux-gnueabihf_sdk-buildroot/arm-buildroot-linux-gnueabihf/sysroot/usr/lib/libiio.so.0 -> libiio.so.0.18

What Im missing here?

Ok I was missing static buildroot path in linked /usr/bin/arm-linux-gnueabihf-pkg-config.

Here are full instructions for building Arduplane on Ubuntu 18.04 build host with @lucasdemarchi supplied buildroot:

# install buildroot
apt install unzip
cd /opt
curl -L -o toolchain-master.zip https://gitlab.com/lucas.de.marchi/dema-rc/-/jobs/545230428/artifacts/download
unzip toolchain-master.zip
unxz toolchain.tar.xz
tar xvf toolchain.tar

# prepare arduplane build env
cd /opt
git clone https://github.com/ArduPilot/ardupilot.git
cd ardupilot/
git fetch && git fetch --tags
git checkout ArduPlane-4.0.6
git submodule update --init --recursive
Tools/environment_install/install-prereqs-ubuntu.sh -y
. ~/.profile

# link pkg-config
cd /opt/arm-buildroot-linux-gnueabihf_sdk-buildroot/bin
ln -sf pkg-config arm-linux-gnueabihf-pkg-config

# build arduplane
cd /opt/ardupilot
export PATH=/opt/arm-buildroot-linux-gnueabihf_sdk-buildroot/bin/:$PATH
./waf configure --board disco
./waf plane
1 Like

Good ! That was my problem, environment not well setup … I can now connect to Disco through SC2. Thank you very much @mainframe and thank you @lucasdemarchi

Be careful about what was put inside your .profile for other build usages in Ubuntu.

Working build binary from 4.0.6 is available here : build406 - Google Drive

Runing Disco have still one issue : no range finder availaible =>

 # LD_LIBRARY_PATH=/data/ftp/internal_000/ardupilot/lib /data/ftp/internal_000/
ardupilot/arduplane -A udpin:0.0.0.0:14550 -B /dev/ttyPA1 -C udp:192.168.43.255:
14550:bcast --module-directory modules
RCOutput_Disco: initialised
SBUS FD 16  115200 FD 17
Bebop: vers 5/10 type 82 nmotors 1 n_flights 119 last_flight_time 3 total_flight_time 6224 maxrpm 12500
Loaded defaults from /data/ftp/internal_000/ardupilot/disco.parm
MS5607 found on bus 1 address 0x77
WARNING: High-speed mode not enabled
MS4525: Found sensor on bus 1 address 0x28
Ignored unknown param **RNGFND_MAX_CM** in defaults file /data/ftp/internal_000/ardupilot/disco.parm
Ignored unknown param **RNGFND_MIN_CM** in defaults file /data/ftp/internal_000/ardupilot/disco.parm
Ignored unknown param **RNGFND_PIN** in defaults file /data/ftp/internal_000/ardupilot/disco.parm
Ignored unknown param **RNGFND_SCALING** in defaults file /data/ftp/internal_000/ardupilot/disco.parm
Ignored unknown param **RNGFND_TYPE** in defaults file /data/ftp/internal_000/ardupilot/disco.parm
Loaded defaults from /data/ftp/internal_000/ardupilot/disco.parm

It seems the parameters got renamed and this needs to be updated in the defaults file. However this is just the defaults… We need to find the right param name. After setting it and make sure it worked we can update the defaults.

Yes understand, just reporting but param file needs to be update as well as disco binary …

What is the requirement for 3 press button to work ?
Any luck to have these files :

  • content of /etc/init.d/rcS_mode_default
  • do you use start_ardupilot.sh , if yes could you please share