Skip to content
This repository was archived by the owner on Mar 17, 2021. It is now read-only.
11 changes: 6 additions & 5 deletions en/SUMMARY.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,9 @@
* [Simulation](simulation/README.md)
* [jMAVSim Simulation](simulation/jmavsim.md)
* [Gazebo Simulation](simulation/gazebo.md)
* [HITL Simulation](simulation/hitl.md)
* [Interfacing to ROS](simulation/ros_interface.md)
* [AirSim Simulation](simulation/airsim.md)
* [Multi-Vehicle Simulation](simulation/multi-vehicle-simulation.md)
* [HITL Simulation](simulation/hitl.md)
* [Hardware](hardware/README.md)
* [Autopilot Hardware](flight_controller/README.md)
* [Porting Guide](debug/porting-guide.md)
Expand Down Expand Up @@ -68,11 +67,13 @@
* [Robotics](robotics/README.md)
* [Offboard Control from Linux](ros/offboard_control.md)
* [ROS](ros/README.md)
* [ROS Installation on RPi](ros/raspberrypi_installation.md)
* [MAVROS \(MAVLink on ROS\)](ros/mavros_installation.md)
* [MAVROS offboard example](ros/mavros_offboard.md)
* [MAVROS Offboard Example](ros/mavros_offboard.md)
* [ROS with Gazebo Simulation](simulation/ros_interface.md)
* [OctoMap Models with ROS](simulation/gazebo_octomap.md)
* [ROS Installation on RPi](ros/raspberrypi_installation.md)
* [External Position Estimation](ros/external_position_estimation.md)
* [Gazebo Octomap](simulation/gazebo_octomap.md)

* [DroneKit](robotics/dronekit.md)
* [Debugging/Logging](debug/README.md)
* [FAQ](debug/faq.md)
Expand Down
6 changes: 5 additions & 1 deletion en/ros/README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
# Robotics using ROS

This section contains topics about using ROS (and offboard control) with PX4.
[ROS](http://www.ros.org/) (Robot Operating System) is a general purpose robotics library that can be used with PX4 for [offboard control](../ros/mavros_offboard.md). It uses the [MAVROS](../ros/mavros_installation.md) node to communicate with PX4 running on hardware or using the [Gazebo Simulator](../simulation/ros_interface.md).

This section contains topics about using ROS for offboard control with PX4.

> **Tip** ROS is only officially supported on Linux platforms.
7 changes: 5 additions & 2 deletions en/ros/mavros_installation.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@

# MAVROS

The [mavros](http://wiki.ros.org/mavros#mavros.2BAC8-Plugins.sys_status) ros package enables MAVLink extendable communication between computers running ROS, MAVLink enabled autopilots, and MAVLink enabled GCS. While MAVRos can be used to communicate with any MAVLink enabled autopilot this documentation will be in the context of enabling communication between the PX4 flight stack and a ROS enabled companion computer.
The [mavros](http://wiki.ros.org/mavros#mavros.2BAC8-Plugins.sys_status) ROS package enables MAVLink extendable communication between computers running ROS, MAVLink enabled autopilots, and MAVLink enabled GCS.

> **Note** *MAVROS* is the "official" supported bridge between ROS and the MAVLink protocol. It is currently being extended to enable [fast-RTPS messaging](../middleware/micrortps.md), including a layer to translate PX4 [uORB messages](../middleware/uorb.md) to common ROS idioms.

While MAVROS can be used to communicate with any MAVLink enabled autopilot this documentation will be in the context of enabling communication between the PX4 flight stack and a ROS enabled companion computer.

## Installation

Expand Down
4 changes: 3 additions & 1 deletion en/setup/dev_env.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Installing Files and Code

PX4 code can be developed on [Linux](../setup/dev_env_linux.md) or [Mac OS](../setup/dev_env_mac.md). We recommend [Ubuntu Linux LTS edition](https://wiki.ubuntu.com/LTS) as this enables building [all PX4 targets](#supported-targets).
PX4 code can be developed on [Linux](../setup/dev_env_linux.md) or [Mac OS](../setup/dev_env_mac.md). We recommend [Ubuntu Linux LTS edition](https://wiki.ubuntu.com/LTS) as this enables building [all PX4 targets](#supported-targets), and using most [simulators](../simulation/README.md) and [ROS](../ros/README.md).

> **Warning** A [Windows](../setup/dev_env_windows.md) toolchain also exists but is not officially supported (we highly discourage its use). It is possible to build PX4 on Windows using a virtual machine running Ubuntu Linux, but this may not provide a reliable platform for Simulation. Before starting to develop on Windows, consider installing a dual-boot environment with [Ubuntu](http://ubuntu.com).

Expand All @@ -15,6 +15,8 @@ Target | Linux (Ubuntu) | Mac | Windows
**Linux-based hardware:** [Raspberry Pi 2/3](https://docs.px4.io/en/flight_controller/raspberry_pi_navio2.html), [Parrot Bebop](https://docs.px4.io/en/flight_controller/bebop.html) | X | |
**Simulation:** [jMAVSim SITL](../simulation/jmavsim.md) | X | X | X
**Simulation:** [Gazebo SITL](../simulation/gazebo.md) | X | X |
**Simulation:** [ROS with Gazebo](../simulation/ros_interface.md) | X | |


## Development Environment

Expand Down
2 changes: 1 addition & 1 deletion en/setup/dev_env_linux_ubuntu.md
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ sudo apt-get install clang-3.5 lldb-3.5 -y

### ROS/Gazebo

Install the dependencies for [ROS/Gazebo](../ros/README.md)) ("Kinetic"). These include Gazebo7 (at time of writing, the default version that comes with ROS). The instructions come from the ROS Wiki [Ubuntu page](http://wiki.ros.org/kinetic/Installation/Ubuntu).
Install the dependencies for [ROS/Gazebo](../ros/README.md) ("Kinetic"). These include Gazebo7 (at time of writing, the default version that comes with ROS). The instructions come from the ROS Wiki [Ubuntu page](http://wiki.ros.org/kinetic/Installation/Ubuntu).
Copy link
Collaborator Author

@hamishwillee hamishwillee Dec 18, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just fixing a typo - missing closing bracket


```sh
# ROS Kinetic/Gazebo
Expand Down
46 changes: 27 additions & 19 deletions en/simulation/gazebo.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
# Gazebo Simulation

[Gazebo](http://gazebosim.org) is a 3D simulation environment for autonomous robots. It supports standalone use (without ROS) or SITL + ROS.
[Gazebo](http://gazebosim.org) is a powerful 3D simulation environment for autonomous robots that is particularly suitable for testing object-avoidance and computer vision. It can also be used for [multi-vehicle simulation](../simulation/multi-vehicle-simulation.md).

**Supported Vehicles:** Quad ([Iris](../airframes/airframe_reference.md#copter_quadrotor_wide_3dr_iris_quadrotor) and [Solo](../airframes/airframe_reference.md#copter_quadrotor_x_3dr_solo), Hex (Typhoon H480), [Generic quad delta VTOL](../airframes/airframe_reference.md#vtol_standard_vtol_generic_quad_delta_vtol), Tailsitter, Plane, Rover, Submarine (coming soon!)

> **Tip** Gazebo is often used with [ROS](../ros/README.md), a toolkit/offboard API for automating vehicle control. If you plan to use PX4 with ROS you should instead [follow the instructions here](../simulation/ros_interface.md) to install Gazebo as part of ROS!

{% youtube %}https://www.youtube.com/watch?v=qfFF9-0k4KA&vq=hd720{% endyoutube %}

Expand All @@ -12,31 +16,30 @@ graph LR;
MAVLink-->SITL;
{% endmermaid %}

## Installation
> **Note** See [Simulation](/simulation/README.md) for general information about simulators, the simulation environment and available simulation configuration (e.g. supported vehicles).

The installation requires to install Gazebo and our simulation plugin.

> **Note** Gazebo version 7 is recommended (the minimum version is Gazebo 6). If you run Linux and installed a ROS version earlier than Jade, be sure to uninstall the bundled Gazebo (sudo apt-get remove ros-indigo-gazebo) version as it is too old.

Check the [Linux](../setup/dev_env_linux.md) and [Mac](../setup/dev_env_mac.md) pages for install infos.
## Installation

#### ROS Users
Gazebo 8 setup in included in our standard build instructions:
- **macOS:** [Development Environment on Mac](http://localhost:4000/en/setup/dev_env_mac.html)
- **Linux:** [Development Environment on Linux > jMAVSim/Gazebo Simulation](../setup/dev_env_linux.md#jmavsimgazebo-simulation)
- **Windows:** Not supported.

The PX4 SITL uses the Gazebo simulator, but does not depend on ROS. The simulation can be [interfaced to ROS](../simulation/ros_interface.md) the same way as normal flight code is.
Additional installation instructions can be found on [gazebosim.org](http://gazebosim.org/tutorials?cat=guided_b&tut=guided_b1).

If you plan to use PX4 with ROS, make sure to follow the [Gazebo version guide for version 7](http://gazebosim.org/tutorials?tut=ros_wrapper_versions#Gazebo7.xseries) for ROS.

#### Normal Installation
## Running the Simulation

Follow the [Linux installation instructions](http://gazebosim.org/tutorials?tut=install_ubuntu&ver=7.0&cat=install) for Gazebo 7.
You can run a simulation by starting PX4 SITL and gazebo with the airframe configuration to load (multicopters, planes, VTOL, optical flow and multi-vehicle simulations are supported).

Make sure to have both installed: `gazebo7` and `libgazebo7-dev`.
The easiest way to do this is to open a terminal in the root directory of the PX4 *Firmware* repository and call `make` for the targets as shown in the following sections.

## Running the Simulation
> **Tip** You can use the [instructions below](#start_px4_sim_separately) to keep Gazebo running and only re-launch PX4. This is quicker than restarting both.

From within the source directory of the PX4 Firmware run the PX4 SITL with one of the airframes (Quads, planes and VTOL are supported, including optical flow):
<span></span>
> **Tip** For the full list of build targets run `make posix list_vmd_make_targets` (and filter on those that start with `gazebo_`).

> **Note** You can use the instructions below to keep Gazebo running and only re-launch PX4.

### Quadrotor

Expand Down Expand Up @@ -98,7 +101,7 @@ make posix gazebo_rover
make posix_sitl_default gazebo_hippocampus
```

![](../../assets/gazebo/hippocampus.png)
![Submarine/UUV](../../assets/gazebo/hippocampus.png)



Expand All @@ -108,7 +111,7 @@ The current default world is the iris.world located in the directory [worlds](ht

## Taking it to the Sky

> **Note** Please refer to the [Installing Files and Code](../setup/dev_env_mac.md) guide in case you run into any errors.
> **Note** Please refer to the [Installing Files and Code](../setup/dev_env.md) guide if you run into any errors.

This will bring up the PX4 shell:

Expand Down Expand Up @@ -139,7 +142,7 @@ The system will print the home position once it finished intializing (`telem> ho
pxh> commander takeoff
```

> **Note** Joystick or thumb-joystick support is available through QGroundControl (QGC). To use manual input, put the system in a manual flight mode (e.g. POSCTL, position control). Enable the thumb joystick from the QGC preferences menu.
> **Note** Joystick or thumb-joystick support [is available](../simulation/README.md#joystickgamepad-integration).

## Set custom takeoff location

Expand All @@ -155,7 +158,7 @@ export PX4_HOME_ALT=28.5
make posix gazebo
```

## Starting Gazebo and PX4 separately
## Starting Gazebo and PX4 separately {#start_px4_sim_separately}

For extended development sessions it might be more convenient to start Gazebo and PX4 separately or even from within an IDE.

Expand All @@ -181,3 +184,8 @@ To extend or customize the simulation interface, edit the files in the `Tools/si
## Interfacing to ROS

The simulation can be [interfaced to ROS](../simulation/ros_interface.md) the same way as onboard a real vehicle.

## Further Information

* [ROS with Gazebo Simulation](../simulation/ros_interface.md)
* [Gazebo Octomap](../simulation/gazebo_octomap.md)
75 changes: 35 additions & 40 deletions en/simulation/gazebo_octomap.md
Original file line number Diff line number Diff line change
@@ -1,78 +1,73 @@
# OctoMap
# OctoMap 3D Models with ROS/Gazebo

[The OctoMap library](http://octomap.github.io/) implements a 3D occupancy grid mapping approach. This guide covers the how to use it with [Rotors Simulator](https://github.com/ethz-asl/rotors_simulator/wiki/RotorS-Simulator).
The [OctoMap library](http://octomap.github.io/) is an open source library for generating volumetric 3D environment models from sensor data. This model data can then be used by a drone for navigation and obstacle avoidance.

This guide covers how to use *OctoMap* with the Gazebo [Rotors Simulator](https://github.com/ethz-asl/rotors_simulator/wiki/RotorS-Simulator) and ROS.

## Installation

The installation requires to install ROS, Gazebo and the Rotors Simulator plugin. Follow the [instructions](https://github.com/ethz-asl/rotors_simulator) on Rotors Simulator to install.
The installation requires ROS, Gazebo and the Rotors Simulator plugin. Follow the [Rotors Simulator instructions](https://github.com/ethz-asl/rotors_simulator) to install.

Next, install The OctoMap library
<div class="host-code"></div>
Next, install the *OctoMap* library:
```sh
sudo apt-get install ros-indigo-octomap ros-indigo-octomap-mapping
rosdep install octomap_mapping
rosmake octomap_mapping
sudo apt-get install ros-indigo-octomap ros-indigo-octomap-mapping
rosdep install octomap_mapping
rosmake octomap_mapping
```

Now, open ~/catkin_ws/src/rotors_simulator/rotors_gazebo/CMakeLists.txt and add the following lines to the bottom of the file
<div class="host-code"></div>
```sh
find_package(octomap REQUIRED)
include_directories(${OCTOMAP_INCLUDE_DIRS})
link_libraries(${OCTOMAP_LIBRARIES})
find_package(octomap REQUIRED)
include_directories(${OCTOMAP_INCLUDE_DIRS})
link_libraries(${OCTOMAP_LIBRARIES})
```

Open ~/catkin_ws/src/rotors_simulator/rotors_gazebo/package.xml and add the following lines
<div class="host-code"></div>
```sh
<build_depend>octomap</build_depend>
<run_depend>octomap</run_depend>
<build_depend>octomap</build_depend>
<run_depend>octomap</run_depend>
```

Run the following two lines.
Run the following two lines:

> **Note** The first line changes your default shell editor (which is vim by default) to gedit. This is recommended for users who have little experience with vim, but can otherwise be omitted.
> **Note** The first line changes your default shell editor to *gedit*. This is recommended for users who have little experience with *vim* (the default editor), but can otherwise be omitted.

<div class="host-code"></div>
```sh
export EDITOR='gedit'
rosed octomap_server octomap_tracking_server.launch
export EDITOR='gedit'
rosed octomap_server octomap_tracking_server.launch
```
and change the two following lines
<div class="host-code"></div>
and change the two following lines:

```sh
<param name="frame_id" type="string" value="map" />
...
<!--remap from="cloud_in" to="/rgbdslam/batch_clouds" /-->
<param name="frame_id" type="string" value="map" />
...
<!--remap from="cloud_in" to="/rgbdslam/batch_clouds" /-->
```
<div class="host-code"></div>
to

to:
```sh
<param name="frame_id" type="string" value="world" />
...
<remap from="cloud_in" to="/firefly/vi_sensor/camera_depth/depth/points" />
<param name="frame_id" type="string" value="world" />
...
<remap from="cloud_in" to="/firefly/vi_sensor/camera_depth/depth/points" />
```



## Running the Simulation

Now run the three following lines, in three separate terminal windows. This opens up Gazebo, Rviz and an octomap server.
Run the following three lines in *separate* terminal windows. This opens up [Gazebo](../simulation/gazebo.md), *Rviz* and an octomap server.

<div class="host-code"></div>
```sh
roslaunch rotors_gazebo mav_hovering_example_with_vi_sensor.launch mav_name:=firefly
rviz
roslaunch octomap_server octomap_tracking_server.launch
roslaunch rotors_gazebo mav_hovering_example_with_vi_sensor.launch mav_name:=firefly
rviz
roslaunch octomap_server octomap_tracking_server.launch
```

In Rviz, change the field 'Fixed Frame' from 'map' to 'world' in the top left of the window.
In *Rviz*, change the field 'Fixed Frame' from 'map' to 'world' in the top left of the window.
Now click the add button in the bottom left and select MarkerArray. Then double click the MarkerArray and change 'Marker Topic' from '/free_cells_vis_array' to '/occupied_cells_vis_array'

Now you should see a part of the floor.

In the Gazebo window, insert a cube in front of the red rotors and you should see it in Rviz.

In the *Gazebo* window, insert a cube in front of the red rotors and you should see it in *Rviz*.

![](../../assets/sim/octomap.png)
![OctoMap Example in Gazebo](../../assets/sim/octomap.png)

Loading