Skip to content

Commit 603532a

Browse files
authored
Merge pull request #74 from aerostack2/v1.1
Update to aerostack2 v1.1
2 parents a557d0a + 36bed11 commit 603532a

File tree

2 files changed

+170
-119
lines changed
  • docs
    • _02_examples/gazebo/project_gazebo
    • _03_aerial_platforms/_gazebo_simulation

2 files changed

+170
-119
lines changed

docs/_02_examples/gazebo/project_gazebo/index.rst

Lines changed: 104 additions & 83 deletions
Original file line numberDiff line numberDiff line change
@@ -13,157 +13,178 @@ To install this project, clone the repository:
1313
To start using this project, please go to the root folder of the project.
1414

1515

16-
17-
.. _project_gazebo_simulated:
16+
.. _project_gazebo_launching:
1817

1918
---------
20-
Execution
19+
Launching
2120
---------
2221

23-
The execution will open a simulation in Gazebo and the Aerostack2 components will use simulation time.
24-
25-
The flags for the components launcher are:
26-
27-
- ``-m``: launch the components for the swarm multiagent system.
28-
- ``-t``: launch keyboard teleoperation.
29-
- ``-r``: record rosbag.
30-
- ``-b``: use `Behavior Tree <https://www.behaviortree.dev/>`_.
31-
- ``-n``: use custom dron namespace.
32-
22+
The execution on the project is split into two parts: Aerostack2 components and ground station.
3323

24+
Launching Aerostack2
25+
====================
3426

35-
.. _project_gazebo_simulated_single_drone:
27+
To launch the Aerostack2 components, execute the following command:
3628

37-
Single drone
38-
============
29+
.. code-block:: bash
3930
40-
In order to launch the components for a **single drone**, do:
31+
./launch_as2.bash
4132
42-
.. code-block:: bash
4333
44-
./launch_as2.bash -t
34+
This will open a Gazebo simulation alongside with a tmux session with an Aerostack2 instance for each drone launched.
4535

46-
This will open a simulation for a single drone alongside the Aerostack2 components necessary for the mission execution.
36+
Launcher offers a few options to customize the execution. ``./launch_as2.bash -h`` will show option list. Options can be set with the following flags:
4737

48-
A window like the following image should open.
38+
- ``-m``: launch multiagent system simulation. By default not set.
39+
- ``-n``: select drones namespace to launch, values are comma separated. By default, it launches all drones from world description file.
40+
- ``-s``: disable launch Gazebo simulator. By default launch simulation.
41+
- ``-g``: launch using gnome-terminal. By default not set, uses tmux.
4942

50-
.. figure:: images/single_drone_gz.png
51-
:scale: 50
52-
:class: with-shadow
53-
54-
Gazebo simulator
43+
Launching Ground Station
44+
========================
5545

56-
It will also open a keyboard teleoperation (argument ``-t``), which you can use to teleoperate the drone with the :ref:`aerostack2 keyboard teleoperation user interface <user_interfaces_keyboard_teleoperation>`.
46+
To launch the ground station, execute the following command:
5747

58-
A window like the following image should popup:
48+
.. code-block:: bash
5949
60-
.. figure:: images/keyboard_teleop_view.png
61-
:scale: 50
62-
:class: with-shadow
63-
64-
Keyboard teleoperation
50+
./launch_ground_station.bash
6551
66-
To start the mission, execute:
52+
Launcher offers a different pool of options to customize the execution. ``./launch_ground_station.bash -h`` will show option list. Options can be set with the following flags:
6753

68-
.. code-block:: bash
54+
- ``-m``: launch multiagent system simulation. By default not set.
55+
- ``-t``: launch keyboard teleoperation. By default not set.
56+
- ``-v``: launch rviz. By default not set.
57+
- ``-r``: record rosbag. By default not set.
58+
- ``-n``: select drones namespace to launch, values are comma separated. By default, it launches all drones from world description file.
59+
- ``-g``: launch using gnome-terminal. By default not set, uses tmux.
6960

70-
python3 mission.py
61+
Closing
62+
=======
7163

72-
Also, you can try the mission planner, which describes the mission in a JSON format:
64+
Close all nodes (aerostack2 and ground_station) with the following command:
7365

7466
.. code-block:: bash
7567
76-
python3 mission_planner.py
68+
./stop_tmuxinator.bash
7769
78-
Here it's what the execution should look like:
70+
.. note::
7971

80-
.. raw:: html
72+
The command ``tmux kill-server`` will have a similar effect but closing all tmux sessions, so be careful if you have other tmux sessions running.
8173

82-
<div style="position: relative; padding-bottom: 56.25%; height: 0; overflow: hidden; max-width: 100%; height: auto;">
83-
<iframe src="https://www.youtube.com/embed/57pg6cQ1MGw" frameborder="0" allowfullscreen style="position: absolute; top: 0; left: 0; width: 100%; height: 100%;"></iframe>
84-
</div>
74+
If launcher was executed with the flag ``-g``, closing should be done manually exiting all gnome-terminal tabs.
8575

86-
To do a clean exit of tmux, execute:
76+
Close **only** the Aerostack2 nodes with the following command:
8777

8878
.. code-block:: bash
8979
90-
./stop.bash
91-
92-
80+
./stop_tmuxinator_as2.bash
9381
94-
.. _project_gazebo_simulated_behavior_tree:
82+
Close **only** the ground station nodes with the following command:
9583

96-
Behavior Tree
97-
=============
84+
.. code-block:: bash
9885
99-
In order to launch the components for using **behavior tree**, do:
86+
./stop_tmuxinator_ground_station.bash
10087
101-
.. code-block:: bash
10288
103-
./launch_as2.bash -b
89+
.. _project_gazebo_mission:
10490

105-
Then, you can start the mission with:
91+
-----------------
92+
Mission execution
93+
-----------------
10694

107-
.. code-block:: bash
95+
The project offers a few examples of mission execution.
10896

109-
python3 mission_behavior_tree.py
97+
- **Keyboard Teleoperation control**: Using reactive teleoperation control. For both single and multiagent swarms.
98+
- **Python API missions**: Using Aerostack2 python API for mission definition. For single drone, using GPS and multiple drones.
99+
- **Behavior Tree missions**: Using Behavior Tree as the mission planner. For single drone only.
100+
- **Mission Interpreter**: Using Aerostack2 mission interpreter. For single drone only.
110101

111-
To do a clean exit of tmux, execute:
112102

113-
.. code-block:: bash
103+
.. _project_gazebo_keyboard_teleoperation:
114104

115-
./stop.bash
105+
Keyboard Teleoperation control
106+
==============================
116107

108+
In order to launch the components for a **single drone**, Aerostack2 launcher does not need any additional flags. Just execute ``./launch_as2.bash``.
109+
This will open a simulation for a single drone alongside the Aerostack2 components necessary for the mission execution.
117110

111+
.. figure:: images/single_drone_gz.png
112+
:scale: 50
113+
:class: with-shadow
114+
115+
Gazebo simulator
118116

117+
Ground station should be launched with ``-t`` flag to enable keyboard teleoperation. Take a look at the :ref:`keyboard teleoperation user guide <user_interfaces_keyboard_teleoperation>` for more information.
118+
A window containing the teleoperation widget should pop up:
119119

120-
.. _project_gazebo_simulated_swarm_drones:
120+
.. figure:: images/keyboard_teleop_view.png
121+
:scale: 50
122+
:class: with-shadow
123+
124+
Keyboard teleoperation
121125

122-
Swarm drones
123-
============
126+
.. note::
124127

125-
In order to launch the components for a **swarm of 3 drones**, do:
128+
The teleoperation widget is also available for multi drone missions. To launch a multi drone simulation, use the flag ``-m`` in both launch commands.
126129

127-
.. code-block:: bash
128130

129-
./launch_as2.bash -m -t
131+
.. _project_gazebo_python_api:
130132

131-
This will open a simulation for a swarm of drones (argument ``-m``) alongside the Aerostack2 components necessary for the mission execution.
133+
Python API missions
134+
===================
132135

133-
A window like the following image should open.
136+
In order to launch the components for **multiple drones**, both launchers require the flag ``-m``.
137+
This will open a simulation for a swarm of drones alongside the Aerostack2 components necessary for the mission execution.
134138

135139
.. figure:: images/swarm_gz.png
136140
:scale: 50
137141
:class: with-shadow
138142

139143
Gazebo simulator
140144

141-
It will also open a keyboard teleoperation (argument ``-t``), which you can use to teleoperate the swarm with the :ref:`aerostack2 keyboard teleoperation user interface <user_interfaces_keyboard_teleoperation>`.
142-
143-
A window like the following image should popup:
144-
145-
.. figure:: images/keyboard_swarm_view.png
146-
:scale: 50
147-
:class: with-shadow
148-
149-
Keyboard teleoperation
145+
There are three python scripts available for mission execution in the project. For single drone missions, use ``python3 mission.py`` for flying a square.
146+
When flying using GPS, use ``python3 mission_gps.py`` which will fly a square using GPS waypoints. Here it is what the execution looks like:
150147

151-
To start the mission, execute:
148+
.. raw:: html
152149

153-
.. code-block:: bash
150+
<div style="position: relative; padding-bottom: 56.25%; height: 0; overflow: hidden; max-width: 100%; height: auto;">
151+
<iframe src="https://www.youtube.com/embed/57pg6cQ1MGw" frameborder="0" allowfullscreen style="position: absolute; top: 0; left: 0; width: 100%; height: 100%;"></iframe>
152+
</div>
154153

155-
python3 mission_swarm.py
156154

157-
Here it's what the execution should look like:
155+
For multi drone missions, use ``python3 mission_swarm.py`` where a group of drones will fly a swarm coreography. Here it is what the execution looks like:
158156

159157
.. raw:: html
160158

161159
<div style="position: relative; padding-bottom: 56.25%; height: 0; overflow: hidden; max-width: 100%; height: auto;">
162160
<iframe src="https://www.youtube.com/embed/gyOPm7apPxo" frameborder="0" allowfullscreen style="position: absolute; top: 0; left: 0; width: 100%; height: 100%;"></iframe>
163161
</div>
164162

165-
To do a clean exit of tmux, execute the following command with the list of the used drones:
163+
.. note::
166164

167-
.. code-block:: bash
165+
To understand how missions are built using the Aerostack2 python API, take a look at the :ref:`development_guide_api_python_api` reference guide.
166+
167+
168+
.. _project_gazebo_mission_interpreter:
169+
170+
Mission Interpreter
171+
===================
172+
173+
Previous missions were defined using python syntaxis. Aerostask2 offers a mission interpreter that allows mission definition using a JSON format.
174+
Currently, the mission interpreter script at the project is only available for single drone missions.
175+
To launch the mission interpreter, execute ``python3 mission_interpreter.py``.
176+
The execution is similar to the python API mission where the drone will fly a square.
177+
178+
179+
.. _project_gazebo_behavior_tree:
180+
181+
Behavior Tree
182+
=============
183+
184+
Missions can also be defined using a behavior tree. The project offers a mission example using a behavior tree for a single drone.
185+
To launch the behavior tree mission, execute ``python3 mission_behavior_tree.py``.
186+
The execution is similar to the python API mission where the drone will fly a square.
187+
188+
.. note::
168189

169-
./stop.bash drone0 drone1 drone2
190+
Trees can be defined using GUIs like :ref:`Groot <https://www.behaviortree.dev/groot/>`.

docs/_03_aerial_platforms/_gazebo_simulation/index.rst

Lines changed: 66 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -243,35 +243,64 @@ There are two aerial models available for simulation. These models are:
243243

244244
Hexrotor base model
245245

246-
In order to add an aerial model with sensors attached to it to the simulated world, Aerostack2 uses a configuration file, with JSON format, with the following structure:
247-
248-
.. code-block:: json
249-
250-
{
251-
"world_name": "empty",
252-
"drones": [
253-
{
254-
"model_type": "quadrotor_base",
255-
"model_name": "drone_sim_0",
256-
"xyz": [ 1.0, 1.0, 0.3 ],
257-
"rpy": [ 0.0, 0.0, 0.0 ],
258-
"payload": [
259-
{
260-
"model_type": "gps",
261-
"model_name": "gps0"
262-
},
263-
{
264-
"model_name": "gimbal",
265-
"model_type": "gimbal_speed",
266-
"payload": {
267-
"model_name": "hd_camera0",
268-
"model_type": "hd_camera"
269-
}
270-
}
271-
]
272-
}
273-
]
274-
}
246+
In order to add an aerial model with sensors attached to it to the simulated world, Aerostack2 uses a configuration file, with YAML format, with the following structure:
247+
248+
.. code-block:: yaml
249+
250+
world_name: "empty"
251+
drones:
252+
- model_name: "drone0"
253+
model_type: "quadrotor_base"
254+
xyz:
255+
- -2.0
256+
- 0.0
257+
- 0.3
258+
rpy:
259+
- 0
260+
- 0
261+
- 0.0
262+
flight_time: 60
263+
payload:
264+
- model_name: "hd_camera0"
265+
model_type: "hd_camera"
266+
- model_name: "gimbal0"
267+
model_type: "gimbal_position"
268+
payload:
269+
model_name: "hd_camera1"
270+
model_type: "hd_camera"
271+
272+
- model_name: "drone1"
273+
model_type: "quadrotor_base"
274+
xyz:
275+
- 2.0
276+
- 0.0
277+
- 0.3
278+
rpy:
279+
- 0
280+
- 0
281+
- 0.0
282+
flight_time: 60
283+
payload:
284+
- model_name: "gimbal1"
285+
model_type: "gimbal_speed"
286+
payload:
287+
model_name: "hd_camera1"
288+
model_type: "hd_camera"
289+
290+
- model_name: "drone2"
291+
model_type: "quadrotor_base"
292+
xyz:
293+
- 0.0
294+
- 0.0
295+
- 0.3
296+
rpy:
297+
- 0
298+
- 0
299+
- 0.0
300+
flight_time: 60
301+
payload:
302+
- model_name: "hd_camera2"
303+
model_type: "hd_camera"
275304
276305
Where:
277306

@@ -315,21 +344,22 @@ Aerostack2 Gazebo platform provides a launch file, which parameters are:
315344
* - namespace
316345
- string
317346
- Namespace of the platform, also named as drone id.
318-
* - config_file
347+
* - simulation_config_file
319348
- string
320349
- Path to the simulation configuration file.
321350
* - control_modes_file
322351
- string
323352
- Optional. File path with the control modes configuration. Default the one in the package.
353+
* - platform_config_file
354+
- string
355+
- Optional. File path with additional platform parameters.
356+
* - log_level
357+
- string
358+
- Optional. Set Logging level. Default 'info'.
324359
* - use_sim_time
325360
- bool
326361
- Optional. Syncronize simulation time with node time. Default false.
327-
* - enable_takeoff_platform
328-
- bool
329-
- Optional. Enable takeoff by platfom. Default false.
330-
* - enable_land_platform
331-
- bool
332-
- Optional. Enable land by platfom. Default false.
362+
333363

334364
Example of launch command:
335365

0 commit comments

Comments
 (0)