Raspberry Pi Dependency And Setup Instructions For Pixhawk Communication
This guide will show you how to take a fresh install of raspbian (latest Buster and legacy Buster) and enable to work with the dronekit-python API to control the pixhawk vehicle from a python script (and without an RC controller). I got tired of running through this install on every YouTube tutorial video, so now you’re here to run through the installs yourself 🙂
The guide consists of dependency installs and raspberry pi config modifications.
This guide is applicable to any Pixhawk + Raspberry Pi setup, including those used on ArduRovers or ArduCopters, or even ArduPlanes. Put another way, this guide will allow ANY ardupilot flight controller to communicate with ANY flavor of raspberry pi (4B, pi zero 2W etc).
If you need a pre-selected Rover kit or Drone kit to remove the guesswork from the part selecting process, check out the links for more information!
Dependencies (BULLSEYE)
- sudo apt-get update
- sudo apt-get upgrade
- sudo apt-get install python3-pip python3-dev python3-opencv python3-numpy
- sudo apt-get install libxml2-dev libxslt-dev
- sudo pip install future
- sudo apt-get install git screen
- sudo pip install pyserial dronekit MAVProxy imutils
- git clone https://github.com/dronedojo/video2calibration
- git clone https://github.com/dronedojo/pidronescripts
Dependencies (BUSTER)
These dependency installs are only confirmed to work on a freshly installed version of Buster.
- sudo apt-get update
- sudo apt-get upgrade
- sudo apt-get install python-pip python-dev python-opencv python-numpy
- sudo pip install future
- sudo apt-get install git screen python-wxgtk4.0 python-lxml
- sudo pip install pyserial dronekit MAVProxy imutils
- git clone https://github.com/dronedojo/video2calibration
- git clone https://github.com/dronedojo/pidronescripts
Setup Instructions
Need to disable serial console to enable uart bridge between pixhawk and raspberry pi.
sudo raspi-config
Go to “Interface Options” then “Serial Port”
Would you like a login shell to be accessible over serial?
select NO
Would you like the serial port hardware to be enabled?
select YES
Exit raspi-config by selecting FINISH and REBOOT
sudo reboot
THEN:
Go to /boot/config with “sudo nano /boot/config.txt”
Go to [all] section
Enter:
enable_uart=1
dtoverlay=disable-bt
Then SAVE and REBOOT.
NOW you should be good to go to use the dronekit API to control the pixhawk over the UART bridge from the Raspberry Pi.