SpiriGo is a ROS package for performing autonomous flights with a MAVLink UAV
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
action
include
initialize
launch
scripts
spiripy
src
srv
test
.gitignore
CMakeLists.txt
README.md
install-spirigo.sh
package.xml
setup.py

README.md

SpiriGo

SpiriGo is a ROS package for performing autonomous flights with a MAVLink UAV. It is built upon mavros and ArduPilot.

SpiriGo is currently in very early stages of development. We have some features planned for later:

  • Setpoints
  • Trajectory planning
  • Motion premitives

But for now it provides some basic convenience methods for mavros use.

Installation and Usage

On the Jetson TK1

SpiriGo is primarily being developed for use on the Jetson TK1 for now. We have thus created an automated install script that will install necessary components on the Jetson for autonomous UAV development. This includes:

Although it is generally recognized that ROS is incompatible with OpenCV4Tegra, our install script correctly works around the issue via methods outlined in this post. To install:

  1. Flash your Jetson with the latest L4T using Jetpack;
  2. Install the Grinch kernel for your version of L4T; then
  3. Get the installation script and run it without root:
$ wget https://raw.githubusercontent.com/Pleiades-Spiri/spiri_go/master/install-spirigo.sh
$ chmod +x install-spirigo.sh
$ ./install-spirigo.sh

Note: you will be prompted for your password right away even though it's without sudo.

Connect the Jetson to the Pixhawk via serial/UART connection

  1. Connect the Jetson's UART ports to an added voltage converter (1.8 V to 5V);
  2. Connect the voltage converter to the Pixhawk;
  3. Make sure that the serial connection is established by checking /dev/ttyTHS0;
  4. Validate the Jetson to Pixhawk communication using maximum baud rate (921600).
TK1 TXB0104 Pixhawk
1.8V: P37 VCCA - VCCB 5V: P1
GND: P38 GND - GND GND: P6
RXd1: P44 A1 - B1 TX1: P2
TXd1: P41 A2 - B2 RX1: P3

See this diagram for pinout details.

Running the launch file

Use this command to launch SpiriGo with serial communication:

$ roslaunch spiri_go jetson.launch

If you see

$ [ INFO] [1447370932.205419674]: CON: Got HEARTBEAT, connected.

It means you've succeeded. Note the baud rate is set to 921600 because that's the highest allowed by mavros. We're looking into increasing this to 1500000 maybe if we really need to.

On Ubuntu 14.04 desktop (for simulator)

To run the simulator, clone a copy of the ardupilot project from ArduPilot. Follow the directions at ArduPilot SITL to set up the simulator. There is also a script, initalization/apm_sim that will do this set-up automatically.

This script is meant to be ran from a fresh Ubuntu 14.04 installation. Please proceed with caution if you plan on installing on a system with ROS already installed.

$ wget https://raw.githubusercontent.com/Pleiades-Spiri/spiri_go/master/initialize/apm_sim
$ chmod +x apm_sim
$ ./apm_sim

Running the simulator and the launch file

Start the simulator with:

$ sim_vehicle.sh --map --console --aircraft test

Next launch the sitl node for spiri:

$ roslaunch spiri_go sitl.launch

Note: if you're running this the first time, you may need to disable RC calibration pre-arm check via the mavproxy console.

If you are using a ground control station such as APM Planner 2, it should connect on UDP port 14551.

Python API

We also provide a python API to control Spiri, using the services and actions provided by the ROS library.

To install this on your system, run:

$ python setup.py install

from the root of this repository.

To use this in a python script, include the following line:

from spiripy import api
spiri = api.SpiriGo()

spiri will then be a SpiriGo instance with the following methods:

wait_for_ros([timeout])
wait_for_fcu([timeout])
get_state()
get_local_position()
takeoff([height])
land()

Your script can be launched as a normal python scripts, but spiri_go, and mavros packages must be running in the background for it to control a quadcopter.

Detailed API documentation coming soon.

Generating documentation

TODO

Developers

Running tests

To test the python API, run:

$ python test/api.py

To test those parts that require the simulator running, use:

$ roscore                                             # run in one terminal
$ sim_vehicle.sh --map --console --aircraft test      # run in a second terminal
$ python test/sim.py                                  # run in a third terminal

Any new methods that are made MUST have a corresponding unit test, and if possible should have a corresponding unit test with the simulator. It is good practice to write the test before implementing the method.