These instructions are for operating a small, multirotor UAS running a PX4 flight control unit or similar variant. They also include setup for a ROS interface using mavlink and mavros. The companion computer can be a number of embedded devices such as a NUC, Odroid, RPi, or ground station PC.
-
We recommend first starting with a tethered configuration (power and communications). A Linux computer can connect to the PX4 using a USB extension and FTDI adapter to the Telemetry 2 port on the PX4 as described here. For initial testing and configuration, it is possible to connect to the PX4's micro USB port.
-
For general manual control, configure the PX4 using QGroundControl (download latest firmware, set up flight modes, etc).
-
If operating in mocap, follow the usma_optitrack instructions for set up motion capture.
-
Configure the PX4 to operate in mocap using external position estimation.
-
Instructions are included to build from source. The firmware can also be downloaded here.
-
Transmitter settings can be found here. At a minimum, the RC transmitter should have manual, position control, offboard control, and a kill switch.
-
First achieve position control of the vehicle using the transmitter.
-
Here is a summary of firmware parameters:
-- The
sys_companion
field is set 921600. --ATT_EXT_HDG_M
parameter is set to 2.
-
- We recommend first starting with a tethered configuration (power and communications). A Linux computer can connect to the PX4 using a USB extension and FTDI adapter to the Telemetry 2 port on the PX4 as described [here] (http://ardupilot.org/dev/docs/odroid-via-mavlink.html).
- Configure PX4 using QGroundControl (download latest firmware, set up flight modes, etc).
- If operating in mocap, follow the usma_optitrack instructions for set up motion capture.
- Configure the PX4 to operate in mocap using [external position] (http://dev.px4.io/external-position.html).
- The
sys_companion
field is set 921600. ATT_EXT_HDG_M
parameter is set to 1 (when using vision_pose topic).CBRK_NO_VISION
parameter set to 0.- Indoor navigation is only achieved by using the external headings from mocap.
- The offboard control documentation provides a good overview.
- Install the mavros package and dependencies (assuming ROS Indigo used).
sudo apt-get install ros-indigo-mavros ros-indigo-mavlink ros-indigo-diagnostic-updater ros-indigo-tf2-ros ros-indigo-angles ros-indigo-eigen-conversions ros-indigo-image-transport ros-indigo-cv-bridge ros-indigo-urdf ros-indigo-tf ros-indigo-control-toolbox
- Clone usma_mavros
cd ~/catkin_ws/src
git clone https://github.com/westpoint-robotics/usma_mavros
- Build
cd ~/catkin_ws/
catkin_make -DMAVLINK_DIALECT=common
- Configure mavros on computer:
- Note some variations to the mavros configuration:
- Using QGC, the
sys_companion
field is set 921600 so that autopilot is enabled with a higher baud rate to communicate with the computer. - In
px4.launch
, - The computer is connecting through
ttyUSB0:921600
instead ofttyACM0:57600
. - Chage the
gcs_url
argument default todefault="udp://:[email protected]:14550"
to match the IP of the ground control station. - QGC can connect to the autopilot using the Default UDP link.
- If using mocap, ensure that the
vision_pose_estimate
plugin is enabled and NOT blacklisted.
- Execute mavros
roslaunch usma_mavros px4.launch
- Check that there is a heartbeat with the PX4.
- Check the debug messages for a valid vision estimate:
FCU: [inav] VISION estimate valid
- Echo the FCU local position to check for propoer coordinate frame conversions:
rostopic echo /mavros/local_position/local
- [Install Ubuntu 14.04 LTS] (https://wiki.ubuntu.com/ARM/RaspberryPi)
- [These instructions are helpful as well] (https://www.raspberrypi.org/documentation/installation/installing-images/linux.md)
- Connect your RPi2 using wired Ethernet.
- Install linux-firmware drivers to enable wifi.
sudo apt-get install linux-firmware
sudo apt-get install wicd
- [Setup wifi on your device] (https://help.ubuntu.com/community/NetworkConfigurationCommandLine/Automatic)
- [Another reference] (https://learn.adafruit.com/adafruits-raspberry-pi-lesson-3-network-setup/setting-up-wifi-with-occidentalis)
$ sudo nano /etc/network/interfaces
auto wlan0
allow-hotplug wlan0
iface wlan0 inet dhcp
wpa-ssid "EECSDS3"
wpa-psk "accessgranted"
- [Install ROS] (http://wiki.ros.org/indigo/Installation/UbuntuARM) 6
- Make these [hardware connections] (http://dev.ardupilot.com/wiki/raspberry-pi-via-mavlink/) between the RPi2 and PX4
- The software instructions in the above link are not followed.
- Assume Ubuntu 14.04 and ROS Indigo installed and a catkin_ws created.
- Setup serial port and baud rate on RPi2:
- Create a temp folder and clone this [package] (https://github.com/vooon/rarog.git)
- Follow the installation [instructions] (https://github.com/vooon/rarog/tree/master/rarog_configs/rpi2)
- Ignore #4 and #5
- Set up embedded computer to match MASTER_URI of base station
cd ~
vim .bashrc
(or your preferred editor)- Add this export to the end of your .bashrc file that matches the IP of your master machine (i.e. the basestation):
- export ROS_MASTER_URI=http://192.169.200.50:11311
- Both the client and server should have this export in their .bashrc
- Edit your /etc/hosts to include the computer name and IP address for the other computer similar to these [instructions] (http://www.faqs.org/docs/securing/chap9sec95.html)
- Other references:
- Run mavros on the embedded computer:
roslaunch usma_mavros px4.launch
- Note some variations to the mavros configuration:
- Using QGC, ensure the
sys_companion
field is set to 921600 so that autopilot is enabled with higher baud rate to communicate with onboard computer - In
px4.launch
, the RPi2 is connecting through ttyAMA0:921600 instead of ttyACM0:57600
- Using QGC, ensure the
- set up ROS_MASTER_URI and IP on all the terminals used in tracking
- Run
roslaunch mavros px4.launch
on onboard computer - on remote host,set up ROS_MASTER_URI and IP and run
roslaunch mocap_optitrack mocap.launch
- on different terminal,set up ROS_MASTER_URI and IP and run
roslaunch mavros_extras teleop_track.launch
- Joystick button map is listed in f710_joy.yaml( for take-off ,land, track button reference)
All tail numbers must be unique
- Mocap rigid body naming - f450_<TAIL_NUM>
- Hostname - odroid-<TAIL_NUM>
- Flash the firmware located in the config folder
- Load the params file in the config folder
- Calibrate all sensors
During OS installation
- Hostname - odroid-<TAIL_NUM>
After OS install
echo "192.168.200.88 ros304" | sudo tee -a /etc/hosts
After ROS install
- clone and make mavros from source
- make sure to compile with one job otherwise it will most likely fail
cd ~/catkin_ws
catkin_make -j1
Generate and share SSH key (no password)
ssh-keygen
cat ~/.ssh/id_rsa.pub
Copy and paste this into the base station's authorized_keys file in a new line
Only once
echo "export ROSLAUNCH_SSH_UNKNOWN=1" >> ~/.bashrc
echo "export ROS_MASTER_URI=http://ros304:11311" >> ~/.bashrc
For each Odroid
echo "<IP_ADDRESS> odroid-<TAIL_NUM" | sudo tee -a /etc/hosts
An ssh key should already be setup. Share with the odroid
cat ~/.ssh/id_rsa.pub
Copy and paste this into the odroid's authorized_keys file in a new line
Make sure a BATTERY is plugged in
Terminal A
roslaunch usma_mavros base_station.launch
Terminal B
roslaunch usma_mavros lpe_mavros_quad.launch TAIL_NUM:=131
Terminal C
rosrun usma_mavros test_flight __ns:=f450_131