Raspberry Pi flies Blade MCX

Just press start & it flies itself.  A self contained autopilot was the goal. 

There were a number of options. Wifi ended up having too many dropouts to be used in any feedback loop, but would have to be used when communicating with a tablet.

So all the intense vision processing had to be done on the camera mount, wired to the cameras. The camera mount required an access point to communicate with a tablet for the user interface.

In the old days, this would have required an FPGA or DSP with custom software.  The computational requirement meant the STM32F407 was completely out of this project.  Nowadays, a 1Ghz linux board computer with webcams & a wifi dongle is the easiest, cheapest way to do it.

The pi only reached 900Mhz, regardless of active cooling.  The complete flight software without user interface used 80% & 1.5A with a cooling fan. With a user interface connected over the network, it used 90%.

Using an LM317 to convert 12V to the 5V was the most reliable power supply.  Amazing for all its hardware multimedia for set top boxes, it can barely do machine vision. According to the goog, this is the 1st time anyone has ever done anything that couldn't be done without overclocking it.

The mane task was completely removing the flight software from the GUI, making the entire user interface connect through the network, then removing the user interface completely.  The dual camera machine vision maxed out at 320x240 30fps. 

Certain uses of memcpy to shift a buffer by 1 byte don't work on the pi. You need for loops. 

a5353460-228-pi07.jpg

a5351326-232-pi03.jpg

a5351328-170-pi05.jpg

Now some useful commands:

Steps to bringing it up:
log in as

user: pi
passwd: raspberry

enable root login:
sudo passwd root

step up to 1Ghz & reduce video RAM:
raspi-config

/boot/config.txt contains the settings

enable static ethernet:

vi /etc/network/interfaces

change

iface eth0 inet dhcp

to

iface eth0 inet static
address 10.0.0.11
netmask 255.255.255.0
gateway 10.0.0.9

disable swap file:
vi /etc/init.d/dphys-swapfile

fix slow ssh login:
vi /etc/hosts


Maximum CPU speed:

echo userspace > /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor
echo 1000000 > /sys/devices/system/cpu/cpu0/cpufreq/scaling_setspeed



Download cross compiler from:

https://github.com/raspberrypi/tools

For some reason, they make a software floating point compiler.  Only download  arm-bcm2708hardfp-linux-gnueabi.

To get the CPU frequency in khz:

cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_cur_freq

Manually set the speed in khz:

echo userspace > /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor
echo 1000000 > /sys/devices/system/cpu/cpu0/cpufreq/scaling_setspeed

E-mail me when people leave their comments –

You need to be a member of diydrones to add comments!

Join diydrones

Comments

  • Is kind of interested. Published but please once this project.

    Peter

  • I am in middle of a design quad core ARM A9 running at 1.2ghz can you tell me how much are you relying on

    graphical co processor in the software design and where is the most computational part of the algorithms are

    Kind regards

    Mehdi

This reply was deleted.