[Author: Alan Tavares & César Quiroz]
OS: Ubuntu 16.04 - xenial ROS version: Kinetic
In order to perform an accurate take-off and land of the Bebop 2, we are using ArUco Markers based on image processing. Firstly, we used a Parrot Bebop 2 model as drone provided by Sphinx-Guide to simulate an environment in Gazebo. The main idea is to use the Aruco Tag to send commands to Bebop 2 to take-off and land autonomously. After simulation, it will be necessary to implement in the real environment using a real Bebop 2.
We use the kinetic installation from: http://wiki.ros.org/kinetic/Installation. Do not forget to install wstool http://wiki.ros.org/wstool
If you are using a Parrot Bebop 1 or 2 model, you'll need to install the ARDroneSDK3 API.
The SDK will help you connect, pilot, receive stream, save and download medias (photo and video), send and play autopilot flight plans and update your drone. You can use it on the Rolling Spider, Cargos, Mambo, Swing, Jumping Sumo, Jumping Sumo Evos, Bebop Drone, Bebop 2, Bebop 2 Power, Disco, Bluegrass, SkyController and SkyController 2.
FreeFlight3 is using this SDK.
This SDK is mainly written is C, it provides libraries for Unix system, Android and iOS.
It also comes with a drone simulator called Sphinx, which is intended to help you test your application before flying with your actual drone. All the information about Sphinx (installation, user manual, application notes) is available HERE (Sphinx-Guide: https://developer.parrot.com/docs/sphinx/installation.html).
Install Gazebo using Ubuntu packages Default installation
You need to install external tools:
- git
- build-essential (only for Linux)
- autoconf
- libtool
- python
- python3
- libavahi-client-dev (only for specific Samples)
- libavcodec-dev (only for specific Samples)
- libavformat-dev (only for specific Samples)
- libswscale-dev (only for specific Samples)
- libncurses5-dev (only for specific Samples)
- mplayer (only for specific Samples)
sudo apt install git repo build-essential autoconf libtool python python3 libavahi-client-dev libavcodec-dev libavformat-dev libswscale-dev libncurses5-dev mplayer
You must install and upgrade python with pip upgrade:
sudo apt install git repo build-essential autoconf libtool python python3 libavahi-client-dev libavcodec-dev libavformat-dev libswscale-dev libncurses5-dev mplayer
sudo apt-get install python-dev python-pip python3-dev python3-pip
sudo -H pip2 install -U pip numpy
sudo -H pip3 install -U pip numpy
sudo pip install numpy scipy matplotlib scikit-image scikit-learn ipython
sudo apt-get install ros-kinetic-joy ros-kinetic-octomap-ros ros-kinetic-aruco python-wstool python-catkin-tools
Download all sources
SDK sources are hosted on github. To download the latest release, you only have to init repo with the arsdk_manifests url:
repo init -u https://github.com/Parrot-Developers/arsdk_manifests.git -m release.xml
After that, you can download all the other repository automatically by executing the command:
repo sync
Then follow the How to build the SDK section:
Linux: Tested on Ubuntu 16.04 - xenial
The command to build the SDK for Unix platform is:
./build.sh -p arsdk-native -t build-sdk -j
Note if you want to build and use the
gazebo_mavlink_interface
plugin you have to get MAVROS as an additional dependency from link below. Follow the installation instructions provided there and build all of its packages prior to building the rest of your workspace Installation-MAVROS
bebop_autonomy is a ROS driver for Parrot Bebop 1.0 and 2.0 drones (quadrocopters), based on Parrot’s official ARDroneSDK3. This driver has been developed in Autonomy Lab of Simon Fraser University by Mani Monajjemi and other contributers. This software is maintained by Sepehr MohaimenianPour (AutonomyLab, Simon Fraser University), Thomas Bamford (Dynamic Systems Lab, University of Toronto) and Tobias Naegeli (Advanced Interactive Technologies Lab, ETH Zürich).
mkdir -p ~/bebop_ws/src && cd ~/bebop_ws
catkin init
git clone https://github.com/AutonomyLab/bebop_autonomy.git src/bebop_autonomy
# Update rosdep database and install dependencies (including parrot_arsdk)
rosdep update
rosdep install --from-paths src -i
# Build the workspace
catkin build
cd ~/bebop_ws/src
git clone https://github.com/cesarhcq/control_bebop_teleop.git
bebop_ws
|
|---> build
|---> devel
|---> logs
|---> src
|
|---> bebop_autonomy
|---> control_bebop_teleop
Just follow the wiki installation for Parrot 1.0 & 2.0
Compiling From Source - Installation-BebopAutonomy
Sphinx Guide - Firststep
Learn About: Rotation Matrix and Euler Angles - M3x3-RPY
A minimum of 1 GByte of storage is necessary to run Sphinx.
The PC must support OpenGL in version 3.0 or higher. To check your version, you can type:
glxinfo | grep "OpenGL version"
Setup your computer to accept packages from Parrot’s public server.
echo "deb http://plf.parrot.com/sphinx/binary `lsb_release -cs`/" | sudo tee /etc/apt/sources.list.d/sphinx.list > /dev/null
sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 508B1AE5
sudo apt-get update
sudo apt-get install parrot-sphinx
Important: As told at the end of the installation, you need to log out from your session, then relog to complete the installation.
Enter in your Catkin Workspace
sudo systemctl start firmwared.service
Important: Do not forget! You must reboot/start your computer, so the firmwared service will be working.
In case you reboot/start your computer, you need to restart the firmwared service.
sudo firmwared
The execution of firmwared is blocking so do not close your shell.
Enter the following command:
fdc ping
PONG
ifconfig or iwconfig
Now, Modify the XML file of the bebop2.drone located in:
subl /opt/parrot-sphinx/usr/share/sphinx/drones/bebop2.drone
Change the parameter <stole_interface>
according to your ifconfig result. In our case wlp3s0
.
<?xml version="1.0" encoding="UTF-8"?>
<drone
name="bebop2"
firmware="http://plf.parrot.com/sphinx/firmwares/ardrone3/milos_pc/latest/images/ardrone3-milos_pc.ext2.zip"
hardware="milosboard">
<machine_params
low_gpu="false"
with_front_cam="true"
with_hd_battery="false"
with_flir="false"
flir_pos="tilted"/>
<pose>default</pose>
<interface>eth1</interface>
<!-- 'wlan0' may need to be replaced the actual wifi interface name -->
<stolen_interface>wlp3s0:eth0:192.168.42.1/24</stolen_interface>
</drone>
Change the IP <launch> = bebop_node.launch
according to IP drone. In case of simulation, you should use default="10.202.0.1"
subl ~bebop_ws/src/bebop_autonomy/bebop_driver/launch/bebop_node.launch
<?xml version="1.0"?>
<launch>
<arg name="namespace" default="bebop" />
<arg name="ip" default="10.202.0.1" /> <!-- <arg name="ip" default="192.168.42.1" | default="10.202.0.1" /> -->
<arg name="drone_type" default="bebop2" /> <!-- available drone types: bebop1, bebop2 -->
<arg name="config_file" default="$(find bebop_driver)/config/defaults.yaml" />
<arg name="camera_info_url" default="package://bebop_driver/data/$(arg drone_type)_camera_calib.yaml" />
<group ns="$(arg namespace)">
<node pkg="bebop_driver" name="bebop_driver" type="bebop_driver_node" output="screen">
<param name="camera_info_url" value="$(arg camera_info_url)" />
<param name="bebop_ip" value="$(arg ip)" />
<rosparam command="load" file="$(arg config_file)" />
</node>
<include file="$(find bebop_description)/launch/description.launch" />
</group>
</launch>
If you need, you can chance of camera calibration file, the first file is bebop2 with 856x480:
subl ~bebop_ws/src/bebop_autonomy/bebop_driver/data/bebop2_camera_calib.yaml
image_width: 856
image_height: 480
camera_name: bebop_front
camera_matrix:
rows: 3
cols: 3
data: [537.292878, 0.000000, 427.331854, 0.000000, 527.000348, 240.226888, 0.000000, 0.000000, 1.000000]
distortion_model: plumb_bob
distortion_coefficients:
rows: 1
cols: 5
data: [0.004974, -0.000130, -0.001212, 0.002192, 0.000000]
rectification_matrix:
rows: 3
cols: 3
data: [1.000000, 0.000000, 0.000000, 0.000000, 1.000000, 0.000000, 0.000000, 0.000000, 1.000000]
projection_matrix:
rows: 3
cols: 4
data: [539.403503, 0.000000, 429.275072, 0.000000, 0.000000, 529.838562, 238.941372, 0.000000, 0.000000, 0.000000, 1.000000, 0.000000]
The second file is bebop1 with 640x368:
subl ~bebop_ws/src/bebop_autonomy/bebop_driver/data/bebop1_camera_calib.yaml
image_width: 640
image_height: 368
camera_name: bebop_front
camera_matrix:
rows: 3
cols: 3
data: [396.17782, 0, 322.453185, 0, 399.798333, 174.243174, 0, 0, 1]
distortion_model: plumb_bob
distortion_coefficients:
rows: 1
cols: 5
data: [-0.001983, 0.015844, -0.003171, 0.001506, 0]
rectification_matrix:
rows: 3
cols: 3
data: [1, 0, 0, 0, 1, 0, 0, 0, 1]
projection_matrix:
rows: 3
cols: 4
data: [400.182373, 0, 323.081936, 0, 0, 403.197845, 172.320207, 0, 0, 0, 1, 0]
In the first window of terminal:
sudo systemctl start firmwared.service
fdc ping
PONG
Check the IP with iwconfig
:
cd ~/bebop_ws
source devel/setup.bash
sphinx src/control_bebop_teleop/world/aruco.world /opt/parrot-sphinx/usr/share/sphinx/drones/bebop2.drone
If you wanna use another world svo_world.world
:
sphinx src/control_bebop_teleop/world/svo_world.world /opt/parrot-sphinx/usr/share/sphinx/drones/bebop2.drone
If you wanna find and change the Big_box with ArUco, if you do not have the big_box, move the file to .gazebo/models/...
:
/bebop_ws/src/control_bebop_teleop/world/big_box
/home/<user>/.gazebo/models/big_box
In case of low GPU, you should put this command
sphinx src/control_bebop_teleop/world/aruco_big_box.world /opt/parrot-sphinx/usr/share/sphinx/drones/bebop2.drone::low_gpu=true
sphinx src/control_bebop_teleop/world/aruco_big_box.world /opt/parrot-sphinx/usr/share/sphinx/drones/bebop2.drone::with_front_cam=false
The world will be executed.
After that, open another terminal and execute the following command in your catkin workspace
.
roslaunch bebop_driver bebop_node.launch
In another terminal, execute:
rosrun control_bebop_teleop image_sub.py
In another terminal, execute:
rosrun control_bebop_teleop landing_pub.py
If you wanna open with dataset. Open a new console and change to the directory where you have downloaded the example dataset. Then type:
roscore
Start RVIZ (Robot Visualizer) in a new console:
cd ~/bebop_ws
rosrun rviz rviz -d src/control_bebop_teleop/rviz_config_aruco.rviz
Open a new console and change to the directory where you have downloaded the example dataset. Then type:
rosbag play <name-of-dataset>.bag