Code Monkey home page Code Monkey logo

rotors_simulator's Introduction

RotorS

RotorS is a MAV gazebo simulator. It provides some multirotor models such as the AscTec Hummingbird, the AscTec Pelican, or the AscTec Firefly, but the simulator is not limited for the use with these multicopters.

There are simulated sensors coming with the simulator such as an IMU, a generic odometry sensor, and the VI-Sensor, which can be mounted on the multirotor.

This package also contains some example controllers, basic worlds, a joystick interface, and example launch files.

Below we provide the instructions necessary for getting started. See RotorS' wiki for more instructions and examples (https://github.com/ethz-asl/rotors_simulator/wiki).

If you are using this simulator within the research for your publication, please cite:

@Inbook{Furrer2016,
author="Furrer, Fadri
and Burri, Michael
and Achtelik, Markus
and Siegwart, Roland",
editor="Koubaa, Anis",
chapter="RotorS---A Modular Gazebo MAV Simulator Framework",
title="Robot Operating System (ROS): The Complete Reference (Volume 1)",
year="2016",
publisher="Springer International Publishing",
address="Cham",
pages="595--625",
isbn="978-3-319-26054-9",
doi="10.1007/978-3-319-26054-9_23",
url="http://dx.doi.org/10.1007/978-3-319-26054-9_23"
}

Installation Instructions - Ubuntu 16.04 with ROS Kinetic

  1. Install and initialize ROS kinetic desktop full, additional ROS packages, catkin-tools, and wstool:
$ sudo sh -c 'echo "deb http://packages.ros.org/ros/ubuntu `lsb_release -sc` main" > /etc/apt/sources.list.d/ros-latest.list'
$ wget http://packages.ros.org/ros.key -O - | sudo apt-key add -
$ sudo apt-get update
$ sudo apt-get install ros-kinetic-desktop-full ros-kinetic-joy ros-kinetic-octomap-ros ros-kinetic-mavlink python-wstool python-catkin-tools protobuf-compiler libgoogle-glog-dev ros-kinetic-control-toolbox ros-kinetic-mavros
$ sudo rosdep init
$ rosdep update
$ source /opt/ros/kinetic/setup.bash
  1. If you don't have ROS workspace yet you can do so by
$ mkdir -p ~/catkin_ws/src
$ cd ~/catkin_ws/src
$ catkin_init_workspace  # initialize your catkin workspace
$ wstool init
$ wget https://raw.githubusercontent.com/ethz-asl/rotors_simulator/master/rotors_hil.rosinstall
$ wstool merge rotors_hil.rosinstall
$ wstool update

Note On OS X you need to install yaml-cpp using Homebrew brew install yaml-cpp.

  1. Build your workspace with python_catkin_tools (therefore you need python_catkin_tools)
$ cd ~/catkin_ws/
$ catkin build
  1. Add sourcing to your .bashrc file
$ echo "source ~/catkin_ws/devel/setup.bash" >> ~/.bashrc
$ source ~/.bashrc

Installation Instructions - Ubuntu 14.04 with ROS Indigo

  1. Install and initialize ROS indigo desktop full, additional ROS packages, catkin-tools, and wstool:
$ sudo sh -c 'echo "deb http://packages.ros.org/ros/ubuntu `lsb_release -sc` main" > /etc/apt/sources.list.d/ros-latest.list'
$ wget http://packages.ros.org/ros.key -O - | sudo apt-key add -
$ sudo apt-get update
$ sudo apt-get install ros-indigo-desktop-full ros-indigo-joy ros-indigo-octomap-ros python-wstool python-catkin-tools protobuf-compiler libgoogle-glog-dev
$ sudo rosdep init
$ rosdep update
$ source /opt/ros/indigo/setup.bash
  1. If you don't have ROS workspace yet you can do so by
$ mkdir -p ~/catkin_ws/src
$ cd ~/catkin_ws/src
$ catkin_init_workspace  # initialize your catkin workspace
$ wstool init

Note for setups with multiple workspaces please refer to the official documentation at http://docs.ros.org/independent/api/rosinstall/html/ by replacing rosws by wstool.

  1. Get the simulator and additional dependencies
$ cd ~/catkin_ws/src
$ git clone [email protected]:ethz-asl/rotors_simulator.git
$ git clone [email protected]:ethz-asl/mav_comm.git

Note On OS X you need to install yaml-cpp using Homebrew brew install yaml-cpp.

Note if you want to use wstool you can replace the above commands with wstool set --git local_repo_name [email protected]:organization/repo_name.git 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. https://github.com/mavlink/mavros

  1. Build your workspace with python_catkin_tools (therefore you need python_catkin_tools)
$ cd ~/catkin_ws/
$ catkin init  # If you haven't done this before.
$ catkin build

Note if you are getting errors related to "future" package, you may need python future: sudo apt-get install python-pip pip install --upgrade pip pip install future

  1. Add sourcing to your .bashrc file
$ echo "source ~/catkin_ws/devel/setup.bash" >> ~/.bashrc
$ source ~/.bashrc

Basic Usage

Launch the simulator with a hex-rotor helicopter model, in our case, the AscTec Firefly in a basic world.

$ roslaunch rotors_gazebo mav_hovering_example.launch mav_name:=firefly world_name:=basic

Note The first run of gazebo might take considerably long, as it will download some models from an online database. Should you receive a timeout error, try running gazebo by itself (e.g. roslaunch gazebo_ros empty_world.launch ) so it has sufficient time to actually download all of the models.

The simulator starts by default in paused mode. To start it you can either

  • use the Gazebo GUI and press the play button

  • or you can send the following service call.

    $ rosservice call gazebo/unpause_physics
    

There are some basic launch files where you can load the different multicopters with additional sensors. They can all be found in ~/catkin_ws/src/rotors_simulator/rotors_gazebo/launch.

The world_name argument looks for a .world file with a corresponding name in ~/catkin_ws/src/rotors_simulator/rotors_gazebo/worlds. By default, all launch files, with the exception of those that have the world name explicitly included in the file name, use the empty world described in basic.world.

Getting the multicopter to fly

To let the multicopter fly you need to generate thrust with the rotors, this is achieved by sending commands to the multicopter, which make the rotors spin. There are currently a few ways to send commands to the multicopter, we will show one of them here. The rest is documented here in our Wiki. We will here also show how to write a stabilizing controller and how you can control the multicopter with a joystick.

Send direct motor commands

We will for now just send some constant motor velocities to the multicopter.

$ rostopic pub /firefly/command/motor_speed mav_msgs/Actuators '{angular_velocities: [100, 100, 100, 100, 100, 100]}'

Note The size of the motor_speed array should be equal to the number of motors you have in your model of choice (e.g. 6 in the Firefly model).

You should see (if you unpaused the simulator and you have a multicopter in it), that the rotors start spinning. The thrust generated by these motor velocities is not enough though to let the multicopter take off.

You can play with the numbers and will realize that the Firefly will take off with motor speeds of about 545 on each rotor. The multicopter is unstable though, since there is no controller running, if you just set the motor speeds.

Let the helicopter hover with ground truth odometry

You can let the helicopter hover with ground truth odometry (perfect state estimation), by launching:

$ roslaunch rotors_gazebo mav_hovering_example.launch mav_name:=firefly world_name:=basic

Create an attitude controller

TODO(ff): Write something here.

Usage with a joystick

Connect a USB joystick to your computer and launch the simulation alongside ROS joystick driver and the RotorS joystick node:

$ roslaunch rotors_gazebo mav_with_joy.launch mav_name:=firefly world_name:=basic

Depending on the type of joystick and the personal preference for operation, you can assign the axis number using the axis_<roll/pitch/thrust>_ parameter and the axis direction using the axis_direction_<roll/pitch/thrust> parameter.

Usage with a keyboard

First, perform a one-time setup of virtual keyboard joystick as described here: https://github.com/ethz-asl/rotors_simulator/wiki/Setup-virtual-keyboard-joystick.

Launch the simulation with the keyboard interface using the following launch file:

$ roslaunch rotors_gazebo mav_with_keyboard.launch mav_name:=firefly world_name:=basic

If everything was setup correctly, an additional GUI should appear with bars indicating the current throttle, roll, pitch, and yaw inputs. While this window is active, the Arrows and W, A, S, D keys will generate virtual joystick inputs, which can then be processed by the RotorS joystick node in the same way as real joystick commands.

Gazebo Version

At a minimum, Gazebo v2.x is required (which is installed by default with ROS Indigo). However, it is recommended to install at least Gazebo v5.x for full functionlity, as there are the following limitations:

  1. iris.sdf can only be generated with Gazebo >= v3.0, as it requires use of the gz sdf ... tool. If this requirement is not met, you will not be able to use the Iris MAV in any of the simulations.
  2. The Gazebo plugins GazeboGeotaggedImagesPlugin, LidarPlugin and the LiftDragPlugin all require Gazebo >= v5.0, and will not be built if this requirement is not met.

rotors_simulator's People

Contributors

andreasantener avatar burrimi avatar cwitting avatar devbharat avatar enricgalceran avatar ffurrer avatar fmina avatar gbmhunter avatar helenol avatar hitimo avatar hitszchen avatar jaeyoung-lim avatar jgoppert avatar karenbodie avatar lorenzmeier avatar maxb91 avatar mfehr avatar michaelpantic avatar orangelynx avatar pascalgohl avatar ptrkfry avatar pvechersky avatar raghavkhanna avatar rikba avatar romanbapst avatar scpeters avatar thomasgubler avatar timethy avatar zacharytaylor avatar zarmomin avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

rotors_simulator's Issues

license header for stage 1

how about this:

/*
 * Copyright (C) 2014 Fadri Furrer, ASL, ETH Zurich, Switzerland
 * Copyright (C) 2014 Michael Burri, ASL, ETH Zurich, Switzerland
 * Copyright (C) 2014 Pascal Gohl, ASL, ETH Zurich, Switzerland
 * Copyright (C) 2014 Sammy Omari, ASL, ETH Zurich, Switzerland
 * Copyright (C) 2014 Markus Achtelik, ASL, ETH Zurich, Switzerland
 *
 * This software is released to the Contestants of the european 
 * robotics challenges (EuRoC) for the use in stage 1. (Re)-distribution, whether 
 * in parts or entirely, is NOT PERMITTED. 
 * 
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 */

Virtual machine problems

Performance Issues

  1. Gazebo doesn't run nicely with only one CPU and no graphic card

Other Issues

  1. Keyboard language should be English

imu-->sensor pose

almost forgot - we should set this to something different that unit transform

create scenes

  • simple scene that just looks nice
  • scene with simple 3-D obstacles. we also need an octomap according to the obstacles

VM Cleanup

  • remove our solutions !!
  • clean history
  • cleanup ssh

angular rate controller?

it's written in the annex, the question is if anyone is going to use it ... can we derive it from the attitude controller?

Implement generic 6 DoF Pose Sensor

@ffurrer
Gazebo plugin skeleton with the following parameters:

  • measurement_rate
  • measurement_delay
  • noise_normal_q (for x, y, z component)
  • noise_normal_p (for x, y, z component)
  • noise_uniform_q (for x, y, z component)
  • noise_uniform_p (for x, y, z component)
  • p_is (position w.r.t IMU --> I assume captured by pose assigned by URDF)
  • q_is (attitude w.r.t IMU --> I assume captured by pose assigned by URDF)
  • p_ws (origin (position) of sensor reference frame w.r.t. world origin)
  • q_ws (origin (quaternion) of sensor reference frame w.r.t. world origin)

is it possible to visualise p_ws / q_ws? (low priority)

@markusachtelik
Implement sensor model

code release todos

release to euroc challengers only

  • license header that restricts to euroc use
  • remove lee controller
  • run code formatter through everything
  • create release repo and squash history
  • create releases in repos we depend on
  • code documentation? :(
  • remove pelican
  • what else to remove, that the challengers shouldn't see/get?
  • remove octomap plugin

test on ubuntu 12.04

to see if our c++11 flags cause trouble.
If we need to fix it, let's keep the change in an extra branch, so that we don't have to redo this at some point.

Validate Simulation

For example attitude angle inputs in both simulation and on the real robot.

Wind Plugin

Implements a plugin that generates a force on a model, through sdf these things should be set:

  • gazebo link name
  • relative xyz offset of the attacking point
  • wind direction
  • mean wind force
  • variance of wind direction (?)
  • variance of wind force
  • wind gusts duration
  • variance of wind gusts duration
  • buttons to manually generate wind gusts

rename mav_control topics

mav_cmd_attitude
mav_cmd_attitude

we should remove "mav", as this is somewhat clear ;)
no abbreviations --> command or control --> let's use control, as we use this for the message name as well

check controllers for uninitialized variables

about every third run, the firefly wants to fly to the moon at take-off. msf estimates everything correct from what I can tell - @burrimi can you please check the (lee)-controller if there could be something uninitialized?

Maybe a problem existed in euroc_simulator/mav_gazebo_plugins/srcgazebo_octomap_plugin.cpp

Hi, guys,

   I found something that maybe incorrect, please check it. 

207 std::map<std::string, bool> objects_in_collision;
208
209 std::string entity_name, entity_name_backwards;
210 double dist, x;
211 math::Vector3 start, end, start_prev;
212
213 start.y = end.y = y;
214 start.z = end.z = z;
215
216 // Set the start point of the ray to the beginning of the bounding box
217 start.x = bounding_box_origin.x - bounding_box_lengths.x / 2 - leaf_size / 2;
218 x = start.x + leaf_size / 2;
219
220 // Set the end of the ray to some large value behind itself to check
221 // if there is a boundary of an object at the current y-z location in -x
222 end.x = -far_away;
223 ray->SetPoints(start, end);
224
225 // Check if there is an intersection in the back
226 ray->GetIntersection(dist, entity_name_backwards);
227
228 bool inside_object = CheckIfInsideObject(entity_name_backwards, start, ray);
229
230 // Set in_object to true, if currently in an object
231 if (!entity_name_backwards.empty() && inside_object) {
232 objects_in_collision.insert(std::pair<std::string, bool>(entity_name, true));

the variable "entity_name" in line 232 hasn't been valued or initialized, but inserted into the objects_in_collision. Should it be entity_name_backwards?

Complement README :)

Hi,

It would be great to have basic setup instructions in the README - a quick Google search didn't bring up immediate results. Essentially it would be great to know how to:

  • Build
  • Launch with Gazebo
  • Command the six motors (order / convention)
  • Extend (this is less critical now)

imu_base link

we should check, why this is a bad idea
3767d2d...
wrong:<bodyName>imu_link</bodyName>
good:<bodyName>base_link</bodyName>

logging format / method

Plain text was guideline. However, since we have to take care of the evaluation ourselves anyway, I'm very much inclined towards using rosbag and its c++/python api http://docs.ros.org/hydro/api/rosbag/html/
--> good performance for logging
--> almost no serialisation / deserialisation implementation effort for us, reuse of all defined messages
--> python api for processing, or even matlab in worst case
ros base install should include all necessary dependencies

decide where we want to store logfiles

~/.ros is probably not the best solution.

However, we need to make sure the directory exists and the logfiles get written, and we shouldn't create a mess in the user's file system.

handle not supported controller commands

in the gazebo controller plugin, we should check if the controller supports a certain type of command. For instance the attitude controller should complain, if it receives a position command.

implement log file writer for simulation tasks

  • @ffurrer how do we get the data from gazebo? cpp / python?
  • format: see #19
  • possibility to enable / disable logging

Data to log:

  • ground truth
    • position
    • linear_velocity
    • attitude quaternion
    • angular velocity
    • in_collision ?
  • simulated sensor data
    • IMU
    • generic pose sensors
  • motor_speeds
  • control commands on all levels according to our message definitions Control* in https://github.com/ethz-asl/mav_comm/tree/master/mav_msgs/msg.
  • services / signals that we emit to the contestants
  • parameters. We only need to be careful not to expose internal parameters here that the contestants are not supposed to know.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.