Wed, Dec 01, 21, master, raspi, database, video-streaming, api server setup
This is a draft, the content is not complete and of poor quality!

required-hardware

  • Develop/staging servers (monolithic)
  • Production servers as determined in the hardware specs
  • Endpoint raspi servers for drone sensors
  • Cloud computing resources

architect

myyonah This following lists the key hardware required to operate myyonah’s ROS Packages

raspi PilotPi with Ubuntu Server

Ubuntu Server on RPi 4B consumes a lot of current and generates a lot of heat. Design for better heat dissipation and high power consumption when using this hardware. :::

Developer Quick Start

OS Image

Both armhf and arm64 arch are supported.

armhf

arm64

Latest OS

Please refer to official cdimage page for any new updates.

First boot

When setting up RaPi’s WiFi for the first time we recommended using a wired Ethernet connection between your home router and RPi, and a monitor and keyboard.

Before booting

Mount the SD card onto your computer and modify the network settings. Please follow the official instruction here.

Now plug the SD card onto your Pi and boot for the first time. Make sure you have shell access to the RPi - either SSH connection over wired Ethernet, or direct accessing with keyboard and monitor.

WiFi region

First install required package:

sudo apt-get install crda

Edit the file /etc/default/crda to change the correct WiFi region. Reference List

sudo nano /etc/default/crda

Then your Pi will able to join your WiFi network after reboot.

Hostname and mDNS

Let’s set up hostname at first.

sudo nano /etc/hostname

Change the hostname to whatever you like. Then install the package required by mDNS:

sudo apt-get update
sudo apt-get install avahi-daemon

Perform a reboot.

sudo reboot

Regain the accessibility through WiFi connection after the above operation.

ssh ubuntu@pi_hostname.local

Password-less Auth (Optional)

You may want to setup passwordless auth as well.

Setting up OS

config.txt

The corresponding file in Ubuntu is /boot/firmware/usercfg.txt.

sudo nano /boot/firmware/usercfg.txt

Replace the file with:

# enable sc16is752 overlay
dtoverlay=sc16is752-spi1
# enable I2C-1 and set the frequency to 400KHz
dtparam=i2c_arm=on,i2c_arm_baudrate=400000
# enable spidev0.0
dtparam=spi=on
# enable RC input
enable_uart=1
# enable I2C-0
dtparam=i2c_vc=on
# switch Bluetooth to miniuart
dtoverlay=miniuart-bt

cmdline.txt

On Ubuntu Server 20.04:

sudo nano /boot/firmware/cmdline.txt

On Ubuntu Server 18.04 or earlier, nobtcmd.txt and btcmd.txt should both be modified.

sudo nano /boot/firmware/nobtcmd.txt

Find console=/dev/ttyAMA0,115200 and remove that part to disable the login shell on serial interface.

Append isolcpus=2 after the last word. The whole file will then look like:

net.ifnames=0 dwc_otg.lpm_enable=0 console=tty1 root=LABEL=writable rootfstype=ext4 elevator=deadline rootwait fixrtc isolcpus=2

The above line tells the Linux kernel do not schedule any process on CPU core 2. We will manually run PX4 onto that core later.

Reboot and SSH onto your Pi.

Check UART interface:

ls /dev/tty*

There should be /dev/ttyAMA0, /dev/ttySC0 and /dev/ttySC1.

Check I2C interface:

ls /dev/i2c*

There should be /dev/i2c-0 and /dev/i2c-1

Check SPI interface:

ls /dev/spidev*

There should be /dev/spidev0.0.

rc.local

In this section we will configure the auto-start script in rc.local. Note that we need to create this file, as it is not present on a fresh Ubuntu OS.

sudo nano /etc/rc.local

Append the content below to the file:

#!/bin/sh

echo "25" > /sys/class/gpio/export
echo "in" > /sys/class/gpio/gpio25/direction
if [ $(cat /sys/class/gpio/gpio25/value) -eq 1 ] ; then
        echo "Launching PX4"
        cd /home/ubuntu/px4 ; nohup taskset -c 2 ./bin/px4 -d -s pilotpi_mc.config 2 &> 1 > /home/ubuntu/px4/px4.log &
fi
echo "25" > /sys/class/gpio/unexport

exit 0

Save and exit. Then set the correct permissions:

sudo chmod +x /etc/rc.local

Don’t forget to turn off the switch when it is not needed! :::

CSI camera

Enable CSI camera will stop anything works on I2C-0. :::

sudo nano /boot/firmware/usercfg.txt

Append the following line at the end of file:

start_x=1

Building the code

To get the very latest version onto your computer, enter the following command into a terminal:

git clone https://github.com/PX4/PX4-Autopilot.git --recursive

This is all you need to do just to build the latest code. :::

Set RPi upload target

Set the IP (or hostname) of your RPi using:

export AUTOPILOT_HOST=192.168.X.X

or

export AUTOPILOT_HOST=pi_hostname.local

Additionally, we need to set the username:

export AUTOPILOT_USER=ubuntu

Build for armhf target

Build the executable file:

cd Firmware
make scumaker_pilotpi_default

Then upload it with:

make scumaker_pilotpi_default upload

Alternative build method for armhf (using docker)

If you are compiling for the first time with docker, please refer to the offical docs.

Execute the command in firmware folder:

./Tools/docker_run.sh "export AUTOPILOT_HOST=192.168.X.X; export AUTOPILOT_USER=ubuntu; export NO_NINJA_BUILD=1; make scumaker_pilotpi_default upload"

mDNS is not supported within docker. You must specify the correct IP address every time when uploading. :::

If your IDE doesn’t support ninja build, NO_NINJA_BUILD=1 option will help. You can compile without uploading too. Just remove upload target. :::

It is also possible to just compile the code with command:

./Tools/docker_run.sh "make scumaker_pilotpi_default"

Build for arm64 target

This step requires aarch64-linux-gnu tool-chain to be installed. :::

Build the executable file:

cd PX4-Autopilot
make scumaker_pilotpi_arm64

Then upload it with:

make scumaker_pilotpi_arm64 upload

Alternative build method for arm64 (using docker)

If you are compiling for the first time with docker, please refer to the offical docs.

Execute the command in PX4-Autopilot folder:

./Tools/docker_run.sh "export AUTOPILOT_HOST=192.168.X.X; export AUTOPILOT_USER=ubuntu; export NO_NINJA_BUILD=1; make scumaker_pilotpi_arm64 upload"

mDNS is not supported within docker. You must specify the correct IP address everytime when uploading. :::

If your IDE doesn’t support ninja build, NO_NINJA_BUILD=1 option will help. You can compile without uploading too - just remove the upload target. :::

It is also possible to just compile the code with command:

./Tools/docker_run.sh "make scumaker_pilotpi_arm64"

Manually run PX4

Connect over SSH and run it with:

cd px4
sudo taskset -c 2 ./bin/px4 -s pilotpi_mc.config

Now PX4 is started with multi-rotor configuration.

If you encountered the similar problem executing bin/px4 on your Pi as following:

bin/px4: /lib/xxxx/xxxx: version `GLIBC_2.29' not found (required by bin/px4)

Then you should compile with docker instead.

Before proceeding to next step, clear the existing building at first:

rm -rf build/scumaker_pilotpi_*

Then go back to the corresponding chapter above.

Post-configuration

Please refer to the instructions here

The following wiki, pages and posts are tagged with

TitleTypeExcerpt
2021-09-26-thesis-indoor-drone.md post After launching a file, call the following services to initialize the drone in Gazebo and the Particle Filter algorithm
Udemy qt5 course by Packt Publishing post Tue, Oct 26, 21, Dive into custom model-views, showcasing the power and flexibility of the mvodel view architecture, with extensive www applications
Pilot handbook + drone resource wiki post Tue, Nov 02, 21, pilot's handbook summarized on top of key cocnepts from rapa drone-resource
Single rotor drone post Thu, Nov 04, 21, single rotor air vehilce with rudder and flap to navigate
Pilot's preflight checklist FAA post Tue, Nov 09, 21, preflight checklist with data mining, d3 visualization and google sheet implementation
final-project post Sat, Nov 27, 21, motion planning dashboard with django vue and fcnd
motion planning dashboard hardware setup post Wed, Dec 01, 21, master, raspi, database, video-streaming, api server setup
px4 mavlink and qgc integration with 4gremoteoperation post Tue, Jan 18, 22, powerful 3d simulation environment for autonomous robots suitable for testing object-avoidance and cv
Airlink by skydrone, youtube post Friday, airlink for mission flight, LTE connectivity and dl-ready
set up with raspi connected to fc post Tue, Jan 25, 22, ardupilot documentation
drone programming primer for software development post Mon, Jan 31, 22, flight stack with firmware middleware and api
runcam with fc connection post Tue, Feb 15, 22, runcam split 2 with fc
my new fixed wing AR Wing Pro, ready for dji HD fpv system post Thu, Feb 17, 22, setup guide after opening the package
realflight 7 setup and console game post Thu, Feb 24, 22, flight simulation with real flight 7
uavmatrix's cast pro docs post Tue, Mar 01, 22, another way to integrate devices to gcs
firmtech7 of naver cafe raspi drone project post Thu, Mar 03, 22, using raspi as fc to control small drone
Garupner Polaron ex post Sun, Mar 06, 22, polaron 2 channels dc charger
svg visualization messages and parameters post Mon, Mar 07, 22, organized structure and tree map of px4 messages and parameters
lx network, airlink, gcs and data transmission on smart radio, rf mesh and quantum encryption post Tue, Apr 26, 22, all about setup and how it operates and managed
Advanced Features page
Advanced Configuration page
Advanced Flight Controller Orientation Tuning page
rflysim tltr page
Bootloader Update page
Bootloader Flashing onto Betaflight Systems page
Compass Power Compensation page
drones.md page my drones I work with and at my disposal.
ESC Calibration page
Flight Termination Configuration page
my 100 supporters page my freelancers I work with since 2018.
index.md page My recent projects are leveraging generative AI across various domains, yielding significant achievements. These encompass Digital Twin, Voice-to-Command, RA...
Land Detector Configuration page
About this site and its author portfolio My portofolio site and its mission statement
🔭AIOT projects page summary.
contents deploy automation page Pilot test on the automation prototype.
pixhawk apm racing drone page summary.
Challenger Engineering Project page summary.
pixhawk tools page rFlyeval project details where Matlab Mathwor Simulink were used for complete process of UAV and UAS.
Korea drone companies page summary.
Racing drone, attck drone page summary.
Django Django Two scoops page summary.
docker learning curve page summary.
🔭 Ground Control Station web-based approach page summary.
gitlab page summary.
🔭lora monitoring app page summary.
🔭 MQTT pages page summary.
My course list page my course list from udemy, udacity, NCS and other sources
Nextcloud page summary.
Automation pipeline page summary.
Pixhawk 4 page summary.
Pixhawk overview page summary.
🔭raspberry pi project page summary.
🔭yuneec realsense obstacle avoidance page summary.
ROS topic for micro control page summary.
🔭 RQt-based gui page summary.
🔭sensor detection page RealSense with Open3D
🔭Serializer with API page summary.
Rules of thumb page Contact me for any support issues.
web-dev ops pages page
🔭 Webrtc page summary.
Parameter Reference page
Finding/Updating Parameters page
Precision Landing page
pixhawk tools advanced page rFlyeval project details where Matlab Mathwork Simulink were used for complete process of UAV and UAS.
pixhawk tools page rFlyeval project details where Matlab Mathwor Simulink were used for complete process of UAV and UAS.
RTK GPS page GNSS/GPS systems
Iridium/RockBlock Satellite Communication System page
Static Pressure Buildup page # Static Pressure Buildup Air flowing over an enclosed vehicle can cause the *static pressure* to change within the canopy/hull. Depending on the location of holes/leaks in the hull, you can end up with under or overpressure (similar to a wing). The change in pressure can affect barometer measurements, leading...
Air Traffic Avoidance: ADS-B/FLARM page
Air Traffic Avoidance: UAS Traffic Management (UTM) page
Using the ECL EKF page