# Raspberry Pi

> *A tiny and affordable computer that you can use to learn programming through fun, practical projects.* [Homepage](https://www.raspberrypi.org/)

Quick Software Getting Started

1. Raspberry Pi
   1. From Scratch
      1. Download [Raspberry Pi Raspbian](https://www.raspberrypi.org/downloads/raspbian/)
      2. Follow [Installation Guide](https://www.raspberrypi.org/documentation/installation/installing-images/README.md)
      3. Follow either&#x20;
         1. [Communicating with Raspberry Pi via MAVLink](http://ardupilot.org/dev/docs/raspberry-pi-via-mavlink.html#communicating-with-raspberry-pi-via-mavlink)
         2. [Making a Mavlink WiFi bridge using the Raspberry Pi](http://ardupilot.org/dev/docs/making-a-mavlink-wifi-bridge-using-the-raspberry-pi.html)
      4. Follow [DroneKit Quick Start Installation](http://python.dronekit.io/guide/quick_start.html#installation)
   2. APSync
      1. Installing [APSync](http://ardupilot.org/dev/docs/apsync-intro.html#apsync-intro-installing-apsync)&#x20;
      2. [APSync Intro](http://ardupilot.org/dev/docs/apsync-intro.html)
      3. Ssh into Raspberry Pi APSync&#x20;
      4. From Raspberry Pi, remove pymavlink and dronekit to install latest version&#x20;

```
$ pip unistall pymavlink (multiple times)
$ pip unistall dronekit (multiple times)
$ sudo pip install --upgrade future MAVProxy
$ cd ~
$ git clone https://github.com/dronekit/dronekit-python.git
$ cd ./dronekit-python
$ sudo python setup.py build
$ sudo python setup.py install
```

## APSync

> APSync is a project sponsored by [eLab](http://elab.co.jp/) which simplifies the setup of companion computers so that they can be used to provide additional functionality to ArduPilot and also to ease integration with internet services. [Homepage](http://ardupilot.org/dev/docs/apsync-intro.html)

> &#x20;Companion computer startup scripts and examples. Github

### Telemetry Splitter

```
apsync@apsync:~ $ sudo find / -name "start_mavproxy_telem_splitter*"
/home/apsync/GitHub/companion/RPI2/Raspbian/start_mavproxy_telem_splitter.sh
```

```
apsync@apsync:~ $ nano /home/apsync/GitHub/companion/RPI2/Raspbian/start_mavproxy_telem_splitter.sh
# this starts mavproxy so that the serial link to the companion computer (on /dev/ttyUSB0) is available to a companion computer and external GCSs via UDP
mavproxy.py --master /dev/ttyUSB0 --baud 921600 --out udpin:localhost:9000 --out udpbcast:192.168.42.255:14550
```

### Home Directory

#### cmavnode

```
apsync@apsync:~ $ nano start_cmavnode/cmavnode.conf
...
[spare_out_0]
    type=udp
    targetip=127.0.0.1
    targetport=9000
    localport=9006
    sim_enable=false

[spare_out_1]
    type=udp
    targetip=127.0.0.1
    targetport=9001
    localport=9007
    sim_enable=false
...
```

```
[spare_out_2]
    type=udp
    targetip=10.0.1.43
    targetport=9002
    localport=9008
    sim_enable=false
```

```
apsync@apsync:~ $ mavproxy.py --master=127.0.0.1:14655 --out=udpbcast:10.0.1.255:14560
apsync@apsync:~ $ mavproxy.py --master=127.0.0.1:14655 --out=udpout:10.0.1.43:14560
```

### Network

```
apsync@apsync:~ $ ifconfig
enxb827eb68daf4: flags=4099<UP,BROADCAST,MULTICAST>  mtu 1500
        ether b8:27:eb:68:da:f4  txqueuelen 1000  (Ethernet)
        RX packets 0  bytes 0 (0.0 B)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 0  bytes 0 (0.0 B)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

lo: flags=73<UP,LOOPBACK,RUNNING>  mtu 65536
        inet 127.0.0.1  netmask 255.0.0.0
        inet6 ::1  prefixlen 128  scopeid 0x10<host>
        loop  txqueuelen 1  (Local Loopback)
        RX packets 1298961  bytes 89853678 (85.6 MiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 1298961  bytes 89853678 (85.6 MiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

wlan0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 10.0.1.128  netmask 255.255.255.0  broadcast 10.0.1.255
        inet6 fe80::9a8a:8293:7439:2bc7  prefixlen 64  scopeid 0x20<link>
        ether b8:27:eb:3d:8f:a1  txqueuelen 1000  (Ethernet)
        RX packets 3248  bytes 230092 (224.6 KiB)
        RX errors 0  dropped 2  overruns 0  frame 0
        TX packets 130914  bytes 12551689 (11.9 MiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

apsync@apsync:~ $ 
```
