Skip to content

Latest commit

 

History

History
330 lines (211 loc) · 11 KB

README.md

File metadata and controls

330 lines (211 loc) · 11 KB

UAV4PE

Open-Source Framework for Planetary Exploration UAV Autonomous Mission Planning

QUT Centre for Robotics Open Source License: MIT

Contents


1) Synopsis

The UAV4PE framework provides:

  • Installation instructions
  • Code for Planetary Exploration UAV Autonomous Mission Planning. The framework relies on diverse software tools including Linux (Ubuntu 20.04), the Robotic Operation System (ROS1), C++, Python and Julia libraries.
  • Source code that can be read for learning and teaching
  • Python Notebooks for experiments results analysis.

2) Getting the simulation environment going

What you need before starting (a Linux machine):

  • You will need a machine with Ubuntu 20.04, installation instructions can be found here. (Raspberry Pi 4 is also supported, using Ubuntu Mate 20.04. However, the emulator using Gazebo can be slow)

2.1) ROS Installation:

ROS Noetic is the current supported and tested version of ROS. To install ROS noetic, you can use the following terminal commands compilation (single commands separated by an empty line):

sudo sh -c 'echo "deb http://packages.ros.org/ros/ubuntu $(lsb_release -sc) main" > /etc/apt/sources.list.d/ros-latest.list'

sudo apt install curl # if not already installed

curl -s https://raw.githubusercontent.com/ros/rosdistro/master/ros.asc | sudo apt-key add -

sudo apt update

sudo apt install ros-noetic-desktop -y

Also, we need some tools to help us manage ROS packages:

sudo apt install python3-rosdep python3-rosinstall python3-rosinstall-generator python3-wstool build-essential -y

sudo rosdep init

rosdep update

The commands presented previously are a compilation from here. Ensure the previous commands successfully downloaded ROS noetic desktop and installed it. If ROS was installed with no errors proceed with the next steps, otherwise, please report the issues you found here.

2.2) Create ROS workspace to add packages

mkdir -p ~/catkin_ws/src

cd ~/catkin_ws/

source /opt/ros/noetic/setup.bash

catkin_make

2.3) Install QUTAS Flight Stack

Let's install the Queensland University of Technology UAS flight stack using the following commands:

wstool init src

cd ~/catkin_ws/

curl https://raw.githubusercontent.com/qutas/info/master/Stack/qfs_noetic.rosinstall > /tmp/qfs_noetic.rosinstall

wstool merge -t src /tmp/qfs_noetic.rosinstall

wstool update -t src

rosdep install --from-paths src --ignore-src -r -y

catkin_make

source ~/catkin_ws/devel/setup.bash

Then we need to install some packages to communicate with the UAV and the motion tracking system:

sudo apt install ros-noetic-mavros ros-noetic-mavros-extras -y

roscat mavros install_geographiclib_datasets.sh | sudo bash

mkdir -p ~/catkin_ws/launch

roscp mavros px4_pluginlists.yaml ./

roscp mavros px4_config.yaml ./

sudo apt-get install ros-noetic-vrpn-client-ros

2.4) Terminal setup

To set up the terminal to work with ROS, we need to include the ROS environment paths and other bits in the .bashrc file.

The .bashrc file is a special Linux file that runs commands at the start of every terminal. So for example, the ROS paths are loaded and available in every terminal you open.

The .bashrc file is normally located in your home directory and the '.' at the front of the file indicates that is a hidden file (so you normally do not see it when in the 'home' folder, at least you activate the visualization of hidden files).

To edit the .bashrc file you can do it using the file browser (after activating the hidden files visualization, pressing Ctrl+h) or with a terminal editor such as 'nano' with the following command:

nano ~/.bashrc

You should see a bunch of code inside the .bashrc file, (if not, there should be a path or name issue). Scroll down in the .bashrc, and add the following chunk of code at the end (you just need to do this one time, at least you format a new ubuntu, or do something else):

# ---------- UAV4PE help scripts ----------
# This ones ensure ROS works in every new terminal
source /opt/ros/noetic/setup.bash
# This ones load your workspace in every new terminal
source ~/catkin_ws/devel/setup.bash
 
# This function let you easy work with multiple ROS computers in the same network in every new terminal
disros() {
  # Setup for distributed ROS
  export ROS_IP="$(hostname -I | cut -d' ' -f1)"
  echo "Identifying as: $ROS_IP"
 
  if [ "$#" -eq 1 ]
  then
    export ROS_MASTER_URI="http://$1:11311"
    echo "Connecting to: $ROS_MASTER_URI"
  fi
}
# Start by default with as ROS master
disros

2.5) Install uav4pe_environments in ROS workspace src folder from GitHub

To install the last version of the uav4pe_environments repository we can use:

cd ~/catkin_ws/src

git clone https://github.com/qutas/uav4pe_environments

cd ~/catkin_ws

catkin_make

source ~/catkin_ws/devel/setup.bash

Well done! Your system is ready to launch the simulation environment.

2.6) Launch simulation:

In a terminal use the following command:

roslaunch uav4pe_environments load_map-16A.launch runSimulation:=True

To close the simulation you can type Ctrl+c in the terminal.

2.7) Install uav4pe_navigation package:

To install the latest version of the uav4pe_navigation repository you can use:

cd ~/catkin_ws/src

git clone https://github.com/qutas/uav4pe_navigation

pip3 install pygame

cd ~/catkin_ws

catkin_make

source ~/catkin_ws/devel/setup.bash

Well done! Your system is ready to launch the simulation environment with the navigation package.

2.8) Launch navigation package in simulation:

We will need three (3) terminals windows to use the navigation package. Run each of the commands below in a single terminal:

roslaunch uav4pe_environments load_map-16A.launch runSimulation:=True

roslaunch uav4pe_navigation load_navigation.launch runSimulation:=True

rosrun uav4pe_navigation send_input

If you found issues, please report the issues here. Otherwise, you should be able to send actions to the navigation module by typing a number between 0 to 4 in the 'send_input' terminal: 0) Stay on the ground, 1) Hover, 2) Explore, 3) Inspect, and 4) Land.

3) Getting the emulation environment going

Emulation Installation steps (Tested on clean Ubuntu 20.04)

3.1) Install Gazebo Libraries

sudo apt-get install ros-noetic-gazebo-plugins

sudo apt-get install ros-noetic-gazebo-ros

sudo apt-get install ros-noetic-image-proc

3.2) Install PX4

cd ~/

git clone https://github.com/PX4/PX4-Autopilot.git --recursive

bash ./PX4-Autopilot/Tools/setup/ubuntu.sh

cd ~/PX4-Autopilot

make px4_sitl gazebo

If the installation is successful you should see a drone in Gazebo. You can close that window. More details can be found here.

3.3) Set up paths for Gazebo and models.

Scroll down in the .bashrc, and add to the end the following chunk of code (you just need to do this one time, at least you format a new ubuntu, or do something else):

# ---------- UAV4PE  Emulation Environment Setup
# PX4 flight controller repository location
export PX4_DIR="$HOME/PX4-Autopilot"
 
## Gazebo environment variables
export GAZEBO_RESOURCE_PATH=/usr/share/gazebo-11
export GAZEBO_MODEL_PATH=${GAZEBO_MODEL_PATH}:$HOME/catkin_ws/src/uav4pe_environments/models
export GAZEBO_RESOURCE_PATH=${GAZEBO_RESOURCE_PATH}:$HOME/catkin_ws/src/uav4pe_environments/worlds
export LB_MODEL_PATH=${LB_MODEL_PATH}:$HOME/catkin_ws/devel/lib
 
## PX4 environment variables
source $PX4_DIR/Tools/setup_gazebo.bash $PX4_DIR $PX4_DIR/build/px4_sitl_default >~/.source_px4.log
export ROS_PACKAGE_PATH=${ROS_PACKAGE_PATH}:$PX4_DIR:$PX4_DIR/Tools/sitl_gazebo
export GAZEBO_PLUGIN_PATH=${GAZEBO_PLUGIN_PATH}:$PX4_DIR/build/px4_sitl_default/build_gazebo

4) Tutorials (Coming soon...)

4.1) Run a single experiment:

4.2) Run multiple experiments:

4.3) Process data from experiments:

4.4) Plot and analyze data from experiments:


Common Issues and Solutions

See the common issues with fixes here.