diff --git a/.travis.yml b/.travis.yml index 81d60ae..9ff07fa 100644 --- a/.travis.yml +++ b/.travis.yml @@ -20,7 +20,7 @@ # `wstool`, and should be listed in a file named dependencies.rosinstall. # # There are two variables you may want to change: -# - ROS_DISTRO (default is indigo, but also kinetic is now compatible). Note that +# - ROS_DISTRO (default is indigo, but also kinetic is now compatible). Note that # packages must be available for ubuntu 14.04 trusty and xenial 16.04, respectively. # # See the README.md for more information. @@ -41,10 +41,18 @@ ################################################################################ -# Use ubuntu xenial (16.04) with sudo privileges. -os: linux -dist: xenial -sudo: required + +# Use ubuntu xenial (16.04) and bionic (18.04) with sudo privileges. +matrix: + include: + - os: linux + dist: xenial + sudo: required + env: ROS_DISTRO=kinetic + - os: linux + dist: bionic + sudo: required + env: ROS_DISTRO=melodic language: - generic @@ -55,7 +63,6 @@ cache: # trigger a build matrix for different ROS distributions if desired. env: global: - - ROS_DISTRO=kinetic - ROS_CI_DESKTOP="`lsb_release -cs`" # e.g. [precise|trusty|...] - CI_SOURCE_PATH=$(pwd) - ROSINSTALL_FILE=$CI_SOURCE_PATH/dependencies.rosinstall @@ -71,17 +78,17 @@ env: before_install: - sudo sh -c 'echo "deb http://packages.ros.org/ros/ubuntu $ROS_CI_DESKTOP main" > /etc/apt/sources.list.d/ros-latest.list' - wget http://packages.ros.org/ros.key -O - | sudo apt-key add - - - sudo rm /var/lib/dpkg/lock - - sudo dpkg --configure -a + - if [[ "$ROS_DISTRO" == "kinetic" ]]; then sudo rm /var/lib/dpkg/lock; fi + - if [[ "$ROS_DISTRO" == "kinetic" ]]; then sudo dpkg --configure -a; fi - sudo apt-get update - - sudo apt-get install ros-$ROS_DISTRO-desktop-full ros-$ROS_DISTRO-joy ros-$ROS_DISTRO-octomap-ros - - sudo apt-get install python-wstool python-catkin-tools - - sudo apt-get install protobuf-compiler libgoogle-glog-dev - # Prepare rosdep to install dependencies. - - sudo rosdep init + - sudo apt-get install ros-$ROS_DISTRO-desktop-full ros-$ROS_DISTRO-joy ros-$ROS_DISTRO-octomap-ros ros-$ROS_DISTRO-mavlink + - sudo apt-get install python-wstool python-catkin-tools python-rosinstall build-essential + - sudo apt-get install protobuf-compiler libgoogle-glog-dev python-rosinstall-generator + # Prepare rosdep to install dependencies. + - sudo rosdep init - rosdep update - source /opt/ros/$ROS_DISTRO/setup.bash - + # Create a catkin workspace with the package under integration. install: - mkdir -p ~/catkin_ws/src @@ -93,13 +100,15 @@ install: - git clone https://github.com/gsilano/BebopS.git - git clone https://github.com/gsilano/rotors_simulator.git - git clone https://github.com/gsilano/mav_comm.git - - git clone https://github.com/gsilano/med_aerial_challenge_launch.git - git clone https://github.com/gsilano/bebop_autonomy.git - - cd ~/catkin_ws/src/rotors_simulator - - git checkout med18 - - cd ~/catkin_ws/src/mav_comm - - git checkout med18 - - rosdep update + - cd ~/catkin_ws/src/rotors_simulator + - if [[ "$ROS_DISTRO" == "kinetic" ]]; then git checkout med18; fi + - if [[ "$ROS_DISTRO" == "melodic" ]]; then git checkout med18_gazebo9; fi + - cd ~/catkin_ws/src/mav_comm + - if [[ "$ROS_DISTRO" == "kinetic" ]]; then git checkout med18; fi + - if [[ "$ROS_DISTRO" == "melodic" ]]; then git checkout med18_gazebo9; fi + - cd ~/catkin_ws/src/BebopS + - if [[ "$ROS_DISTRO" == "melodic" ]]; then git checkout dev/gazebo9; fi - cd ~/catkin_ws - rosdep install --from-paths src -i - catkin build diff --git a/CHANGELOG.rst b/CHANGELOG.rst index d001f71..58e1f5f 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -2,6 +2,26 @@ Changelog for package BebopS ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +1.0.1 (2019-12-27) +------------------ +* Updated the README.md file with instructions for Ubuntu 16.04, ROS Kinetic Kame and Gazebo 9 (master) +* Contributors: Giuseppe Silano + +2.0.1 (2019-12-26) +------------------ +* Updated the README.md file with instructions for Ubuntu 18.04, ROS Melodic Morenia and Gazebo 9 (master) +* Deleted the README.md file to avoid misunderstanding in the installation procedure (dev/gazebo9 branch) +* Inserted the default RotorS IMU (ADIS16448 IMU) in the list of the available sensors when running the simulation +* Disable shadows in Gazebo 9 and added the rotors_interface_plugin. The plugin is necessary for reading the sensors messages +* Deleted TravisCI (.travisci.yml) file. Only one file is present in the master. The file handles all the distro. +* Contributors: Giuseppe Silano + +0.2.2 (2019-12-26) +------------------ +* Inserted the default RotorS IMU (ADIS16448 IMU) in the list of the available sensors when running the simulation +* Disabled shadows in Gazebo 9 +* Contributors: Giuseppe Silano + 0.2.1 (2019-04-04) ------------------ * The namespace was modified considering the ROS rules (only lowercase letters) @@ -37,7 +57,7 @@ Changelog for package BebopS * Added the Kalman filter * Added plots in the launch file to monitor the position and linear velocity errors between the Kalman filter output and the odometry ground truth values. In order to develop such functionality, the teamsannio messages have been created. * A yaml file needed to set up the Kalman filter has been created. Such file contains the tuning matrix of the filter and the standard deviations that characterize the odometry virtual sensor. -* The Kalman filter works with the noisy attitude (standard deviation 0.017). This function considers the nonideality of the attitude filter onboard the quadrotor. +* The Kalman filter works with the noisy attitude (standard deviation 0.017). This function considers the nonideality of the attitude filter onboard the quadrotor. * Contributors: Pasquale Oppido, Giuseppe Silano, Luigi Iannelli 0.1.3 (2018-05-25) @@ -63,4 +83,3 @@ Changelog for package BebopS ------------------ * Initial Ubuntu package release * Contributors: Giuseppe Silano, Pasquale Oppido, Luigi Iannelli - diff --git a/README.md b/README.md index e67989c..acc0966 100644 --- a/README.md +++ b/README.md @@ -5,142 +5,242 @@ # BebopS -BebopS is an extension of the ROS package [RotorS](https://github.com/ethz-asl/rotors_simulator), aimed to modeling, developing and integrating the [Parrot Bebop 2](https://www.parrot.com/us/drones/parrot-bebop-2) quadcopter in the physics based simulation environment Gazebo. The contribution can be also considered as a reference guide for expanding the RotorS functionalities in the UAVs filed and for simulating in a way rather close to reality the real aircraft behavior. +BebopS is an extension of the ROS package [RotorS](https://github.com/ethz-asl/rotors_simulator), aimed to modeling, developing and integrating the [Parrot Bebop 2](https://www.parrot.com/us/drones/parrot-bebop-2) quadcopter in the physics based simulation environment Gazebo. The contribution can be also considered as a reference guide for expanding the RotorS functionalities in the Unmanned Aerial Vehicles (UAVs) filed and for simulating in a way rather close to reality the real aircraft behavior. -The repository was made for designing complex control systems for the Parrot Bebop, but it can also used for any other aircraft. Indeed, the controller implementation is a not easy process and having a complete software platform for simulating the multirotor behavior, considering also its on-board sensors, could give advantages in terms of coding and deployment of the controller software. +The repository was made for designing complex control systems for the Parrot Bebop 2, but it can also be used as a basis for any other aircraft with the aim of helping in the controller implementation. Indeed, implementing the own control algorithm is a not easy process and having a complete software platform for simulating the multirotor behavior, considering also its on-board sensors and the secondary effects, could give advantages in terms of coding and deployment of the controller software. -Moreover, the software platform allows to detect and manage instabilities of the Parrot Bebop 2 that otherwise might not arise when considering only its Matlab/Simulink simulations. Finally, implementation details synchronization, overflow or any other software realted issue, can be isolated when looking at the Matlab/Simulink platform only, but their effects can be investigated by considering the proposed repository. +Finally, the software platform allows to detect and manage instabilities of the Parrot Bebop 2 that otherwise might not arise when considering only its Matlab/Simulink simulations. Moreover, implementation details such as synchronization, overflow or any other software related issue, can be isolated when looking at the Matlab/Simulink platform only, but their effects can be investigated by considering the proposed repository. -Simple cases study are considered (`task1_world.launch` and `task2_world.launch`) in order to show how the package works and the validity of the employed dynamical model together the control architecture of the quadcopter. +Simple cases study are considered (`task1_world.launch` and `task2_world.launch`) in order to show how the package works and the validity of the employed dynamical model together the control architecture of the quadrotor. The code is released under Apache license, thus making it available for scientific and educational activities. -The platform has been developed by using Ubuntu 16.04 and the Kinetic Kame version of ROS. Although the platform is fully compatible with Indigo Igloo version of ROS and Ubuntu 14.04, such configuration is not recommended since the ROS support is expected to be closed in April 2019. +The platform was developed using Ubuntu 16.04 and the Kinetic Kame version of ROS, but it is also fully compatible with Ubuntu 18.04 and the Melodic Morenia distribution of ROS. Although backwards compatibility is guarantee, i.e., the platform is fully compatible with Indigo Igloo version of ROS and Ubuntu 14.04, such configuration is not recommended since the ROS support is expected to be closed in April 2019. Below we provide the instructions necessary for getting started. See [BebopS' wiki](https://github.com/gsilano/BebopS/wiki) for more instructions and examples. -If you are using this simulator within the research for your publication, please take a look at the [Publications page](https://github.com/gsilano/BebopS/wiki/Publications). The page contains core papers and all linked works (using the platform). +If you are using this simulator for research purposes especially for your publication, please take a look at the [Publications page](https://github.com/gsilano/BebopS/wiki/Publications). The page contains the core papers and all related works (using the platform). -The authors are grateful to the [LARICS Lab](https://larics.fer.hr/larics) of the University of Zagreb that created the basis for the ROS package through the [sofware repositry](https://github.com/larics/mmuav_gazebo). In fact, the platform is an extract of the work carried out for the industrial challenge of the 26th Mediterranean Conference on Control and Automation (MED’18) in which the authors took part ([here the link](https://ieeexplore.ieee.org/document/8667511) to the conference report). +The authors are grateful to the [LARICS Lab](https://larics.fer.hr/larics), University of Zagreb, for the initial work done to make the platform compatible with the latest changes to the RotorS package. Here the link to them [sofware repositry](https://github.com/larics/mmuav_gazebo). The software platform is an extract of the work carried out for the industrial challenge of the 26th Mediterranean Conference on Control and Automation (MED’18) in which the authors took part ([here the link](https://ieeexplore.ieee.org/document/8667511) to the conference report). -Installation Instructions - Ubuntu 16.04 with ROS Kinetic +Installation Instructions - Ubuntu 18.04 with ROS Melodic and Gazebo 9 --------------------------------------------------------- To use the code developed and stored in this repository some preliminary actions are needed. They are listed below. - 1. Install and initialize ROS kinetic desktop full, additional ROS packages, catkin-tools, and wstool: +1. Install and initialize ROS Melodic desktop full, additional ROS packages, catkin-tools, and wstool: + +```console +$ 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-key adv --keyserver 'hkp://keyserver.ubuntu.com:80' --recv-key C1CF6E31E6BADE8868B172B4F42ED6FBAB17C654 +$ sudo apt update +$ sudo apt install ros-melodic-desktop-fulll ros-melodic-joy ros-melodic-octomap-ros ros-melodic-mavlink +$ sudo apt install python-wstool python-catkin-tools protobuf-compiler libgoogle-glog-dev ros-melodic-control-toolbox +$ sudo rosdep init +$ rosdep update +$ echo "source /opt/ros/melodic/setup.bash" >> ~/.bashrc +$ source ~/.bashrc +$ sudo apt install python-rosinstall python-rosinstall-generator build-essential +``` +2. If you don't have ROS workspace yet you can do so by + +```console +$ mkdir -p ~/catkin_ws/src +$ cd ~/catkin_ws/src +$ catkin_init_workspace # initialize your catkin workspace +$ cd ~/catkin_ws/ +$ catkin init +$ cd ~/catkin_ws/src +$ git clone -b med18_gazebo9 https://github.com/gsilano/rotors_simulator.git +$ git clone -b med18_gazebo9 https://github.com/gsilano/mav_comm +$ git clone -b dev/gazebo9 https://github.com/gsilano/BebopS.git +$ git clone https://github.com/AutonomyLab/bebop_autonomy.git +$ cd ~/catkin_ws +``` + +3. Build your workspace with `python_catkin_tools` (therefore you need `python_catkin_tools`) + +```console +$ rosdep install --from-paths src -i +$ catkin build +``` + +4. Add sourcing to your `.bashrc` file + +```console +$ echo "source ~/catkin_ws/devel/setup.bash" >> ~/.bashrc +$ source ~/.bashrc +``` + +5. Update the pre-installed Gazebo version. This fix the issue with the `error in REST request for accessing api.ignition.org` + +```console +$ sudo sh -c 'echo "deb http://packages.osrfoundation.org/gazebo/ubuntu-stable `lsb_release -cs` main" > /etc/apt/sources.list.d/gazebo-stable.list' +$ wget http://packages.osrfoundation.org/gazebo.key -O - | sudo apt-key add - +$ sudo apt update +$ sudo apt install gazebo9 gazebo9-* +$ sudo apt upgrade +``` + +Installation Instructions - Ubuntu 16.04 with ROS Kinetic and Gazebo 7 +--------------------------------------------------------- +To use the code developed and stored in this repository some preliminary actions are needed. They are listed below. + + 1. Install and initialize ROS Kinetic desktop full, additional ROS packages, catkin-tools, and wstool: + + ```console +$ 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 +$ sudo apt-get install python-wstool python-catkin-tools protobuf-compiler libgoogle-glog-dev ros-kinetic-control-toolbox +$ sudo rosdep init +$ rosdep update +$ echo "source /opt/ros/kinetic/setup.bash" >> ~/.bashrc +$ source ~/.bashrc +$ sudo apt-get install python-rosinstall python-rosinstall-generator build-essential ``` - $ 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 - $ sudo apt-get install python-wstool python-catkin-tools protobuf-compiler libgoogle-glog-dev ros-kinetic-control-toolbox - $ sudo rosdep init - $ rosdep update - $ echo "source /opt/ros/kinetic/setup.bash" >> ~/.bashrc - $ source ~/.bashrc - $ sudo apt-get install python-rosinstall python-rosinstall-generator python-wstool build-essential - ``` + 2. 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 - $ cd ~/catkin_ws/ - $ catkin init - $ cd ~/catkin_ws/src - $ git clone https://github.com/gsilano/rotors_simulator.git - $ git clone https://github.com/gsilano/mav_comm - $ git clone https://github.com/gsilano/BebopS.git - $ git clone https://github.com/AutonomyLab/bebop_autonomy.git - $ cd ~/catkin_ws/src/rotors_simulator - $ git checkout med18 - $ cd ~/catkin_ws/src/mav_comm - $ git checkout med18 - $ cd ~/catkin_ws - $ rosdep update + ```console +$ mkdir -p ~/catkin_ws/src +$ cd ~/catkin_ws/src +$ catkin_init_workspace # initialize your catkin workspace +$ cd ~/catkin_ws/ +$ catkin init +$ cd ~/catkin_ws/src +$ git clone -b med18 https://github.com/gsilano/rotors_simulator.git +$ git clone -b med18 https://github.com/gsilano/mav_comm +$ git clone https://github.com/gsilano/BebopS.git +$ git clone https://github.com/AutonomyLab/bebop_autonomy.git ``` 3. Build your workspace with `python_catkin_tools` (therefore you need `python_catkin_tools`) - ``` - $ rosdep install --from-paths src -i - $ catkin build - ``` +```console +$ rosdep install --from-paths src -i +$ catkin build +``` 4. Add sourcing to your `.bashrc` file - ``` - $ echo "source ~/catkin_ws/devel/setup.bash" >> ~/.bashrc - $ source ~/.bashrc - ``` +```console +$ echo "source ~/catkin_ws/devel/setup.bash" >> ~/.bashrc +$ source ~/.bashrc +``` -Basic Usage +Installation Instructions - Ubuntu 16.04 with ROS Kinetic and Gazebo 9 --------------------------------------------------------- +To use the code developed and stored in this repository with ROS Kinetic and Gazebo 9, first follow what is reported in the previous section. Then, use the instruction below. -Launching the simulation is quite simple, so as customizing it: it is enough to run in a terminal the command + 1. Remove Gazebo 7 and all related packages, and then install Gazebo 9: - ``` - $ roslaunch bebop_simulator bebop_without_controller.launch - ``` - -> **Note** The first run of gazebo might take considerably long, as it will download some models from an online database. To avoid any problems when starting the simulation for the first time, you may run the `gazebo` command in the terminal line. +```console +$ sudo apt-get remove ros-kinetic-gazebo* gazebo* +$ sudo sh -c 'echo "deb http://packages.osrfoundation.org/gazebo/ubuntu-stable `lsb_release -cs` main" > /etc/apt/sources.list.d/gazebo-stable.list' +$ wget http://packages.osrfoundation.org/gazebo.key -O - | sudo apt-key add - +$ sudo apt-get update +$ sudo apt-get install gazebo9 gazebo9-* ros-kinetic-gazebo9-* +$ sudo apt upgrade +``` -The `bebop_without_controller.launch` file lets simulate the Parrot Bebop dynamics when no controllers are in the loop. Therefore, the drone pose can be modified by publishing the propellers angular velocity on the `/gazebo/command/motor_speed` topic. Moreover, external disturbances can also be simulated by varying the contents of the variables: `wind_force` (it represents the wind force expressed in Newton), `wind_start` (it indicates the time in seconds after which external forces will begin to act), `wind_duration` (the inveral time), `wind_direction` (the wind direction along the x, y and z-axis, its values are bounded between [-1, 1]). + 2. Additional packages are required to build the package. -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. +```console +$ sudo apt-get install libeigen3-dev ros-kinetic-image-view ros-kinetic-parrot-arsdk libprotobuf-dev libprotoc-dev ros-kinetic-joy-teleop ros-kinetic-nav-msgs ros-kinetic-mav-msgs libyaml-cpp-dev ros-kinetic-nodelet ros-kinetic-mav-planning-msgs ros-kinetic-urdf ros-kinetic-image-transport ros-kinetic-roslint ros-kinetic-angles ros-kinetic-cv-bridge ros-kinetic-tf2-geometry-msgs ros-kinetic-xacro ffmpeg libavcodec-dev libavformat-dev libavutil-dev libswscale-dev ros-kinetic-camera-info-manager ros-kinetic-cmake-modules ros-kinetic-gazebo-msgs ros-kinetic-mavros-msgs ros-kinetic-control-toolbox ros-kinetic-mav-msgs ros-kinetic-libmavconn ros-kinetic-mavros ros-kinetic-octomap-msgs ros-kinetic-geographic-msgs ros-kinetic-mavlink ros-kinetic-mavros-extras ros-kinetic-mav-planning-msgs ros-kinetic-joy +``` +> **Note** Missing packages can be found and then installed by using the command `rosdep check --from-paths src` into the `catkin_ws` folder. - ``` - $ rostopic pub /gazebo/command/motor_speed mav_msgs/Actuators '{angular_velocities: [1000, 1000, 1000, 1000]}' - ``` + 3. Make Gazebo 9 compatible with ROS Kinetic Kame -To speed up the simulation, a certain set of sensors can be included when simulating the drone dynamics by varying the flags: `enable_odometry_sensor_with_noise`/`disable_odometry_sensor_with_noise` (it includes the odometry sensor with bias and noise terms), `enable_ground_truth_sensor` (it enables the ground truth sensor), `enable_wind_plugin` (even external disturbances will be simulated) and `enable_laser1D` (it enables the 1-D laser scanner). +```console +$ cd ~ +$ mkdir -p ros-kinetic-gazebo9-pkgs +$ cd ros-kinetic-gazebo9-pkgs +$ git clone -b feature/ros-kinetic-gazebo9-pkgs https://github.com/gsilano/BebopS.git +$ chmod 777 gazebo9.sh +$ ./gazebo9.sh +``` -These value can be modified before simulating the drone behavior acting on the launch file or at runtime by running on the terminal: +4. Clean the workspace and compile again the code + +```console +$ cd ~/catkin_ws +$ catkin clean # digit y when required +$ cd ~/catkin_ws/src/rotors_simulator +$ git checkout med18_gazebo9 +$ cd ~/catkin_ws/src/mav_comm +$ git checkout med18_gazebo9 +$ cd ~/catkin_ws/src/BebopS +$ git checkout dev/gazebo9 +$ cd ~/catkin_ws +$ catkin build +$ source ~/.bashrc +``` - ``` - $ roslaunch bebop_simulator bebop_without_controller.launch enable_odometry_sensor_with_noise:=true - ``` - -Finally, the waypoint and Kalman filters, as well as the data storage, can be enabled/disabled by using the variables: `csvFilesStoring`, `csvFilesStoringTime` (simulation time after which the data will be saved), `user_account` (required to define the storage path), `waypoint_filter` and `EKFActive`. +This guide can be used a basis for fixing what has been discussed in [ethz-asl/rotors_simulator#506](https://github.com/ethz-asl/rotors_simulator/pull/506). -While, running in a terminal the command +Basic Usage +--------------------------------------------------------- - ``` - $ roslaunch bebop_simulator task1_world.launch - ``` - -the Parrot Bebop takes off from the ground and keeps indefinitely the hovering position subjected to wind gusts (up to 0.5 N) for a minute. Conversely, +Running the simulation is quite simple, so as customizing it: it is enough to run in a terminal the command - ``` - $ roslaunch bebop_simulator task2_world.launch - ``` - -the drone starts to follow the trajectory expressed as a sequence of waypoints (x_r, y_r, z_r and \psi_r) published at a settled time (t_0, t_1, t_3, etc.), as described in `waypoint.txt` file. To avoid system instabilities, a waypoint filter is employed to smooth the trajectory. +```console +$ roslaunch bebop_simulator bebop_without_controller.launch +``` -Gazebo Version --------------- +> **Note** The first run of gazebo might take considerably long, as it will download some models from an on-line database. To avoid any problems when starting the simulation for the first time, you may run the `gazebo` command in the terminal line. -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, although the platform is fully compatible with the Gazebo 9. Before running the script, consider the following limitations: +The `bebop_without_controller.launch` file simulates the Parrot Bebop dynamics when any controller is in the loop. Therefore, the drone pose can be modified by publishing the propellers angular velocity on the `/gazebo/command/motor_speed` topic. -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. +> **Note** If you use the version compatible with ROS Melodic, `/command/motor_speed` is the topic to consider. + +Moreover, external disturbances can also be simulated by varying the contents of the variables: `wind_force` (it represents the wind force expressed in Newton), `wind_start` (it indicates the time in seconds after which external forces will begin to act), `wind_duration` (the interval time), `wind_direction` (the wind direction along the x, y and z-axis, its values are bounded between [-1, 1]). -ROS Kinetic installs Gazebo 7 by default so it is recommended to remove the previous installation. Proceeded to the installation section if installing for the first time. +To fly the multirotor, it is necessary to generate thrust with the rotors, this is achieved by sending commands to the quadrotor that make the rotors spin. + ```console +$ rostopic pub /gazebo/command/motor_speed mav_msgs/Actuators '{angular_velocities: [1000, 1000, 1000, 1000]}' ``` -$ sudo apt-get remove ros-kinetic-gazebo* -$ sudo apt-get upgrade + +> **Note** If you use the ROS Melodic version of the code, the command to consider is +```console +$ rostopic pub /command/motor_speed mav_msgs/Actuators '{angular_velocities: [1000, 1000, 1000, 1000]}' ``` -Install the core of the ROS and rest of the packages can be added manually +To speed up the simulation, a certain set of sensors can be included when simulating the drone dynamics by varying the flags: `enable_odometry_sensor_with_noise`/`disable_odometry_sensor_with_noise` (it includes the odometry sensor with bias and noise terms), `enable_ground_truth_sensor` (it enables the ground truth sensor), `enable_wind_plugin` (even external disturbances will be simulated), `enable_laser1D` (it enables the RotorS default IMU, i.e., the ADIS16448 IMU) and `enable_laser1D` (it enables the 1-D laser scanner). + +These value can be modified before simulating the drone behavior acting on the launch file or at runtime by running on the terminal: + ```console +$ roslaunch bebop_simulator bebop_without_controller.launch enable_odometry_sensor_with_noise:=true ``` -$ sudo apt-get install ros-kinetic-gazebo9-ros-pkgs ros-kinetic-gazebo9-ros-control ros-kinetic-gazebo9* (for Gazebo 9) + +Finally, the waypoint and the Kalman filters, as well as the data storage (file used as log), can be enabled/disabled by using the variables: `csvFilesStoring`, `csvFilesStoringTime` (simulation time after which the data will be saved), `user_account` (required to define the storage path), `waypoint_filter` and `EKFActive`. + +While, running in a terminal the command + +```console +$ roslaunch bebop_simulator task1_world.launch ``` +the Parrot Bebop takes off from the ground and keeps indefinitely the hovering position subjected to wind gusts (up to 0.5 N) for a minute. Conversely, + +```console +$ roslaunch bebop_simulator task2_world.launch +``` + +the drone starts to follow the trajectory expressed as a sequence of waypoints (`x_r, y_r, z_r` and `\psi_r`) published at a settled time (`t_0, t_1, t_3`, etc.), as described in `waypoint.txt` file. To avoid system instabilities, a waypoint filter is employed to smooth the trajectory. + +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 functionality, although the platform is fully compatible with the **Gazebo 9**. Before running the script, consider 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. + Bugs & Feature Requests -------------------------- @@ -151,5 +251,3 @@ YouTube video A YouTube video showing the Parrot Bebop during the trajectory tracking is reported. The trajectory, described using waypoints, is shown in the `waypoint.txt` file. [![MED18_Industrial_Challenge, BebopS](https://github.com/gsilano/BebopS/wiki/images/Video_Miniature_YouTube_SMC19.png)](https://youtu.be/ERkgSCoM6OI "MED18_Industrial_Challenge, BebopS") - - diff --git a/launch/bebop_without_controller.launch b/launch/bebop_without_controller.launch index 88e47ac..e8d588f 100644 --- a/launch/bebop_without_controller.launch +++ b/launch/bebop_without_controller.launch @@ -21,6 +21,7 @@ + @@ -47,6 +48,7 @@ + diff --git a/launch/spawn_bebop.launch b/launch/spawn_bebop.launch index fa1c99b..8a40a1f 100644 --- a/launch/spawn_bebop.launch +++ b/launch/spawn_bebop.launch @@ -18,6 +18,7 @@ + @@ -29,6 +30,7 @@ enable_ground_truth_sensor:='$(arg enable_ground_truth_sensor)' enable_wind_plugin:='$(arg enable_wind_plugin)' enable_laser1D:='$(arg enable_laser1D)' + enable_imu:='$(arg enable_imu)' namespace:=$(arg name) wind_force:=$(arg wind_force) wind_start:=$(arg wind_start) diff --git a/launch/task1_world.launch b/launch/task1_world.launch index cf43be9..3a5f6c1 100644 --- a/launch/task1_world.launch +++ b/launch/task1_world.launch @@ -17,6 +17,16 @@ + + + + + + + + + @@ -36,6 +46,14 @@ + + + + + + + diff --git a/launch/task2_world.launch b/launch/task2_world.launch index 1a9e397..cbde155 100644 --- a/launch/task2_world.launch +++ b/launch/task2_world.launch @@ -25,6 +25,7 @@ + @@ -52,6 +53,7 @@ + diff --git a/package.xml b/package.xml index 4ac5eef..b390f64 100644 --- a/package.xml +++ b/package.xml @@ -1,11 +1,10 @@ bebop_simulator - 0.2.1 + 0.2.2 This package aims to simulate the behavior of the Parrot Bebop by using SIL methodologies. Giuseppe Silano - Pasquale Oppido Luigi Iannelli Giuseppe Silano diff --git a/urdf/bebop.urdf.xacro b/urdf/bebop.urdf.xacro index 70b0aa1..d934206 100644 --- a/urdf/bebop.urdf.xacro +++ b/urdf/bebop.urdf.xacro @@ -51,6 +51,30 @@ + + + + + + + + + model://sun + + + + 0 + + EARTH_WGS84 47.3667