■ UART
ArduPilot는 5개의 UART를 지원하며 각 UART의 용도는 아래와 같다.
-UART A - the console (usually USB, runs MAVLink telemetry)
-UART B - the first GPS
-UART C - primary telemetry (telem1 on Pixhawk, 2nd radio on APM2)
-UART D - secondary telemetry (telem2 on Pixhawk)
-UART E - 2nd GPS
UART를 테스트하기 위해 libraries/AP_HAL/examples/UART_test를 실행하면 "hello" 메세지를 5개의 UART에 지속적으로 보낸다.
■ MissionPlanner 연결
MissionPlanner IP: 192.168.0.2
BBBMini IP: 192.168.0.3
※ 실행 전 아래의 명령으로 MissionPlanner의 윈도우 방화벽을 열어준 후 실행할 것.
NETSH ADVFIREWALL FIREWALL ADD RULE NAME="MissionPlanner" DIR=IN ACTION=ALLOW PROGRAM="C:\Program Files (x86)\MissionPlanner\MissionPlanner.exe" ENABLE=YES
arducopter -A udp:192.168.0.2:14550 -B /dev/ttyO5 -C /dev/ttyO4
arducopter -A tcp:192.168.0.3:5760 -B /dev/ttyO5 -C /dev/ttyO4
■ Ubuntu PC에서 구버전 빌드 스크립트
#!/bin/bash
###########################################################
#
# Ardupilot 빌드 (bbbmini)
# (Ubuntu PC에서 빌드)
#
# https://github.com/mirkix/BBBMINI/blob/master/doc/software/software.md
#
###########################################################
CURRENT_DIR=${PWD}
GIT_BRANCH=Copter-3.5
VERSION_STR=${GIT_BRANCH:7}
USE_WAF=1
# 이전 빌드 삭제
rm -f arducopter-*
rm -f examples.tar.gz
rm -rf ardupilot
# 소스코드 다운로드
git clone -b ${GIT_BRANCH} https://github.com/ArduPilot/ardupilot.git
cd ${CURRENT_DIR}/ardupilot
git submodule update --init --recursive
# 빌드에 필요한 패키지 설치
./Tools/scripts/install-prereqs-ubuntu.sh -y
source ~/.profile
# Build
make clean
if [ ${USE_WAF} = 1 ]
then
./waf configure --board=bbbmini
./waf
./waf examples
mv ${CURRENT_DIR}/ardupilot/build/bbbmini/bin/arducopter ${CURRENT_DIR}/arducopter-${VERSION_STR}
tar -C ${CURRENT_DIR}/ardupilot/build/bbbmini -czf ${CURRENT_DIR}/examples.tar.gz examples
else
cd ${CURRENT_DIR}/ardupilot/ArduCopter
make bbbmini
# 바이너리를 현재 디렉토리에 복사
mv ArduCopter.elf ${CURRENT_DIR}/arducopter-${VERSION_STR}
fi
rm -rf ~/.ccache
rm -rf ~/.cache
■ 빌드되어 있는 패키지 받기
wget -O - http://airrobotics.de/deb/bbmini/keyFile | sudo apt-key add -
echo "deb http://airrobotics.de/deb/bbbmini /" | sudo tee -a /etc/apt/sources.list
apt update
apt install arducopter
Software
How to prepare your BeagleBone to use as BBBmini.
- Debian 8.6 jessie
- GCC 4.9
- Kernel 4.4 PREEMPT RT
- BBBmini devicetree loaded at startup.
Prepare microSD with your Linux host computer
- Download Debian image https://rcn-ee.net/rootfs/bb.org/testing/2016-10-02/console/BBB-blank-debian-8.6-console-armhf-2016-10-02-2gb.img.xz
- Decompress image:
unxz BBB-blank-debian-8.6-console-armhf-2016-10-02-2gb.img.xz
- Copy image to microSDcard (>= 2GB):
sudo dd bs=4M if=./BBB-blank-debian-8.6-console-armhf-2016-09-21-2gb.img of=/dev/sdX
/dev/sdX should point to your microSD, be careful here!!! Uselsblk
to figure out, which is your mircroSD. The process can take 15-30 minutes depending on the speed of your microSD card.sync
and remove mircroSDInstall Debian to your BeagleBone eMMC
- Plug prepared microSD into BeagleBone
- While holding down the boot button, apply power to the board. If there is a newer Debian installed, holding down the boot button is not necessary.
- Wait some minutes until Debian is installed (all four LEDs turned on).
- Remove power.
- Remove microSD.
- Apply power again.
- Connect to the BeagleBone
ssh debian@beaglebone
- Password
temppwd
- Update software:
sudo apt update && sudo apt upgrade -y
- Install software:
sudo apt install -y bb-cape-overlays cpufrequtils g++ pkg-config gawk git make screen python python-dev python-lxml python-pip
- Install Python library:
sudo pip install future
- Set link to pkg-config:
sudo ln -s pkg-config /usr/bin/arm-linux-gnueabihf-pkg-config
- Update scripts:
cd /opt/scripts && sudo git pull
- Expend partition:
sudo /opt/scripts/tools/grow_partition.sh
- Install RT Kernel:
sudo /opt/scripts/tools/update_kernel.sh --bone-rt-kernel --lts-4_4
- Add BBBmini DTB:
sudo sed -i 's/#dtb=$/dtb=am335x-boneblack-bbbmini.dtb/' /boot/uEnv.txt
- Add ADC DTBO:
sudo sed -i 's/#cape_enable=bone_capemgr.enable_partno=/cape_enable=bone_capemgr.enable_partno=BB-ADC/g' /boot/uEnv.txt
- Set clock to fixed 1GHz
sudo sed -i 's/GOVERNOR="ondemand"/GOVERNOR="performance"/g' /etc/init.d/cpufrequtils
- Reboot system:
sudo reboot
- Login again:
ssh debian@beaglebone
- Clone ArduPilot code:
git clone https://github.com/ArduPilot/ardupilot.git
- Change dir:
cd ardupilot/Tools/Linux_HAL_Essentials/pru/rangefinderpru
- Install Rangefinder firmware:
sudo make install
- Your BeagleBone is now ready to use.
Compile ArduPilot native on BeagleBone
cd ardupilot
git checkout Copter-3.4.6
for ArduCopter orgit checkout ArduPlane-3.7.1
for ArduPlane orgit checkout APMrover2-3.1.2
for ArduRovergit submodule update --init --recursive
./waf configure --board=bbbmini
./waf
(take about 1h20m)cp build/bbbmini/bin/* /home/debian/
Cross compile ArduPilot (faster) with Ubuntu computer
Get the source code:
git clone https://github.com/diydrones/ardupilot.git
cd ardupilot
./Tools/scripts/install-prereqs-ubuntu.sh
git checkout Copter-3.4.6
for ArduCopter orgit checkout ArduPlane-3.7.1
for ArduPlane orgit checkout APMrover2-3.1.2
for ArduRovergit submodule update --init --recursive
./waf configure --board=bbbmini
./waf
scp build/bbbmini/bin/* debian@beaglebone:/home/debian/
Run ArduPilot
Now you can check your hardware here.
ArduCopter:
sudo /home/debian/arducopter-quad
(plus parameter)ArduPlane:
sudo /home/debian/arduplane
(plus parameter)ArduRover:
sudo /home/debian/ardurover
(plus parameter)Parameter mapping:
start parameter ArduPilot serial port -A SERIAL0 -B SERIAL3 -C SERIAL1 -D SERIAL2 -E SERIAL4 -F SERIAL5 Check http://ardupilot.org/copter/docs/parameters.html#serial0-baud-serial0-baud-rate to set the right value for
SERIALx_BAUD
andSERIALx_PROTOCOL
To connect a MAVLink groundstation with IP 192.168.178.26 add
-C udp:192.168.178.26:14550
To use MAVLink via radio connected to UART4 add
-C /dev/ttyO4
.If there is a GPS connected to UART5 add
-B /dev/ttyO5
.Example: MAVLink groundstation with IP 192.168.178.26 on port 14550 and GPS connected to
/dev/ttyO5
UART5.
sudo /home/debian/arducopter-quad -C udp:192.168.178.26:14550 -B /dev/ttyO5
Example: MAVLink groundstation via radio connected to UART4 and GPS connected to
/dev/ttyO5
UART5.
sudo /home/debian/arducopter-quad -B /dev/ttyO5 -C /dev/ttyO4
Automatic start ArduPilot after boot
If ArduPilot should start automatically at boot time follow the instructions below:
- Connect to your BeagleBone via ssh with
ssh debian@beaglebone
- Edit
/etc/rc.local
withsudo nano /etc/rc.local
- Modify file to (use your ArduPilot file and parameter):
#!/bin/sh -e # # rc.local # # This script is executed at the end of each multiuser runlevel. # Make sure that the script will "exit 0" on success or any other # value on error. # # In order to enable or disable this script just change the execution # bits. # # By default this script does nothing. /bin/sleep 10 /home/debian/arducopter-quad -B /dev/ttyO5 -C /dev/ttyO4 > /home/debian/arducopter.log & exit 0
- Save file:
Strg + o
+ Enter- Exit nano:
Strg + x
- Reboot BegaleBone with
sudo reboot