-
Notifications
You must be signed in to change notification settings - Fork 7
Software Guides
Users of PixHawk and PixRacer should refer here before following this guide.
If anything goes wrong, remember that you can always reset your safely firmware through QGCS (use the latest stable build)!
This guide assumes that you have already cloned the px4 firmware repository, and have at least compiled the code for the PixHawk (if you have jMavSim running, you are way past this point).
Please ensure you can successfully build the firmware before continuing.
For the purposes of stability, we will be working using the most recent stable release (v1.6.5). To do this, navigate to the px4 firmware directory (most likely: ~/src/Firmware
) and run the command:
git checkout v1.6.5
You should get a message that says something like this if successful:
M Tools/jMAVSim
M Tools/sitl_gazebo
M mavlink/include/mavlink/v1.0
M mavlink/include/mavlink/v2.0
M src/drivers/gps/devices
M src/lib/DriverFramework
M src/lib/ecl
Note: checking out 'v1.6.5'.
...
HEAD is now at f160743... Join us on Slack README badge
From here, you should clean our build directories, and recompile the code to make sure everything is working as expected (there may be some warnings about submodules, just follow the instructions that are provided in the warnings):
make clean
make px4fmu-v2_default
If there are no errors, and the code compiles successfully, then it is time to move on. The specific file that needs to be changed is under ./ROMFS/px4fmu_common/init.d/rcS
.
Open this file in a text editor, and navigate to line 194. Change the line from:
set MAVLINK_F default
To:
set MAVLINK_F "-d /dev/ttyS1 -b 921600 -m onboard -r 80000 -x"
This is all you should have to change to get the port running at full speed. From here, recompile the code (it should be a lot quicker this time):
make px4fmu-v2_default
Now plug in your px4 (and if you're on a VM, remember to enable passthrough mode), and run:
make px4fmu-v2_default upload
And you should be left with the messages:
Erase : [====================] 100.0%
Program: [====================] 100.0%
Verify : [====================] 100.0%
Rebooting.
[100%] Built target upload
Now you will have to open up QGCS, and redo the autopilot calibrations.sudo ln -s ./usr/lib/systemd/system/sshd.service ./etc/systemd/system/multi-user.target.wants/sshd.service
You should also be able to connect the PixFalcon to MavROS using the USB serial adapter you have previously made (but remember to change the baud rate in the launch file to 921600)!
The first step is to select and download an actual disk image. This won't be covered in detail, however the guides below provide links to some potential disk images to use. The file you should prepare to be flashed should be a .img
file.
To begin the flashing procedure:
- Download Etcher
- Plug in your disk
- Run Etcher
- Select your disk image
- Select the disk to flash the image to
- Begin the flash
Once the flash is complete, you should be able to plug the disk back into the onboard computer and start up the device.
This disk image can be [found here](TODO: Upload). The image itself is ~5.3GB, so you will most likely need an 8GB SD Card to properly flash the disk image. Download the image and flash the disk image as detailed above.
Username: pi
Password: raspberry
The following packages have been pre-installed and configured:
- tmux
- picocom
- python
- wiringpi and wiringpi-python
- ROS
- vision-opencv
- raspicam_node
- mavros and mavros_extras
The following scripts are configured:
- A graphical user interface can be started after logging in by running the command:
startx
- A ROS catkin workspace has already been setup:
~/catkin_ws/
- The hardware serial port
uart0
has been enabled ready for use as:/dev/serial0
- The command
picocom /dev/serial0
can be used to manually interface with the serial port - A login can be enabled to allow interfacing without a screen or WiFi by running the command:
sudo systemctl enable [email protected]
- The command
- A launch file for Naze32 flight controllers running the robin firmware has been configured for
/dev/serial0
:~/catkin_ws/launch/naze32.launch
There are a few steps that are necessary to take to get your onboard computer running ROS. The first is to be aware that it is highly recommended (though not strictly necessary) to have the onboard computer running the correct version of Ubuntu for the ROS distribution you expect to run. As an example, the best choice for running ROS Kinetic is Ubuntu 16.xx, however, more information can be found on the ROS installation guides.
To begin, you will need to flash the OS image onto the SD card, disk, or hard-drive that your onboard computer will use.
Firstly, you will have to obtain the disk image of the OS that you wish to install. As an onboard computer typically will not have constant access to a monitor or display, it is recommended that you start with an image based off of Ubuntu Server. The server image is the same as normal Ubuntu, but does not come with a desktop installed by default (however if you change your mind later, the desktops are quite simple to install).
For Raspberry Pi 2/3, the Ubuntu MATE is recommended (make sure you get the correct image for RPi2 or RPi3).
For Odroid devices, the appropriate Ubuntu 'Minimal' is recommended (look for the images with '...minimal-odroid-xu4...' in the name for XU4 devices).
Follow the instructions above to flash the selected disk image.
In some cases, SSH does not come enabled by default. Depending on your disk image, you may be able to skip this section and come back to it later if you are getting the error "connection refused" when trying to log in via SSH.
First off, make sure you have an ssh server installed:
sudo apt install openssh-server
If you have access to a monitor and keyboard, you should be able to log in, access a terminal, and run the command:
sudo systemctl enable sshd.service
sudo systemctl start sshd.service
Or in some versions:
sudo systemctl enable ssh.service
sudo systemctl start ssh.service
For a typical Ubuntu disk image, if you only have access to the SD card, you should be able to do the following:
- Connect the SD card to a computer running linux
- Mount the SD card, and open a terminal in the root directory
- Run the following command:
sudo ln -s ./usr/lib/systemd/system/sshd.service ./etc/systemd/system/multi-user.target.wants/sshd.service
It is recommended that you perform the first boot with the system configured as one of the following:
- Plugged into a router (that you have access to see the connected system's IP addess) with an Ethernet cable
- Plugged into a monitor/display with a keyboard and WiFi module attached (if not built in)
If using the first method, you will need to SSH into your onboard computer to gain access to the command line. To do this, you will need to do the following:
- From Windows:
- Use putty
- Follow this guide
- From Linux:
- Follow this guide
The onboard computer typically has a single administrator account set up, with the credentials as follows (however they may be different):
- Raspberry Pi:
- Username: ubuntu
- Password: ubuntu
- ODroid:
- Username: root
- Password: odroid
Once you are logged in, you should see a command prompt that looks something like the following:
user@linux $
Or:
root@linux #
If you see the second prompt with a #
, this typically signifies that you are running as an administrator account. It is good practice (and necessary to run ROS properly) to set up a standard user account, and then re-log as the new user (replace username
with something of your own):
useradd -m username
passwd username
Note: As you should be using a relatively standard Ubuntu system image, you should look up documentation and guides relating to software referencing Ubuntu, rather than your onboard computer type (i.e. "How to set up WiFi in Ubuntu" rather than "How to set up WiFi on a Raspberry Pi"). Failing to do so will most likely make a mess of your system image. Hardware issues (such as "How to enable the camera on Raspberry Pi") should still be fine.
After you manage to log in, you probably want to perform a system update:
sudo apt update
sudo apt upgrade
The last step in a typical upgrade is to set a custom hostname. When connected a properly configured router, this will allow you to connect to your onboard computer without needing to look up the IP address every time. You will have to change 2 files to correct set the host name (refer here for some tips on using the command line). Replace newhostname
with something else of your choosing (for a group project, something like "rpi-gX" may be a good choice).
sudo nano /etc/hosts
# Add in a line at the top that says:
127.0.0.1 newhostname
sudo nano /etc/hostname
# Replace the old name with the new one:
newhostname
You should now reboot for everything to take effect and update correctly:
sudo reboot
Now your system should be functioning and up to date! The next step is to install ROS and any other software you might need.
Note: Depending on the OS image that you download, the system partition may automatically be resized on your first boot (Raspberry Pi images typically do this). To make sure that your system has as much disk space as possible, it may be necessary to perform a live resize the system partition. A script to do this can be found here.
- Home
- Common Terminology
- UAV Setup Guides (2024)
- UAV Setup Guides (2022)
- UAV Setup Guides (2021)
- UAV Setup Guides (--2020)
- General Computing
- On-Board Computers
- ROS
- Sensors & Estimation
- Flight Controllers & Autopilots
- Control in ROS
- Navigation & Localization
- Communications
- Airframes
- Power Systems
- Propulsion
- Imagery & Cameras
- Image Processing
- Web Interfaces
- Simulation