Skip to content

Commit a30904c

Browse files
committed
Update multirotor simulator example
1 parent d4bd89b commit a30904c

File tree

5 files changed

+106
-57
lines changed

5 files changed

+106
-57
lines changed
Lines changed: 106 additions & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -1,115 +1,164 @@
1-
.. _project_multirotor_simulator:
1+
.. _project_ms:
22

3-
============================
4-
Multirotor Simulator Example
5-
============================
3+
===================================
4+
Simple Multirotor Simulator Example
5+
===================================
66

77
To install this project, clone the repository:
88

99
.. code-block:: bash
1010
11-
git clone https://github.com/aerostack2/project_as2_multirotor_simulator
11+
git clone https://github.com/aerostack2/project_as2_multirotor_simulator.git
1212
1313
To start using this project, please go to the root folder of the project.
1414

1515

16-
17-
.. _project_multirotor_simulator_simulated:
16+
.. _project_ms_launching:
1817

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

23-
The execution will launch the Aerostack2 components.
22+
The execution on the project is split into two parts: Aerostack2 components and ground station.
2423

25-
The flags for the components launcher are:
24+
Launching Aerostack2
25+
====================
2626

27-
* ``-n <namespace>`` - namespace for the drone. Default, not specified and uses ``config/world.yaml`` configuration. If specified, it uses ``config/platform_config_file.yaml`` configuration.
28-
* ``-m`` - multi agent mode. Default is disabled. If specified, it uses ``config/world_swarm.yaml`` configuration.
29-
* ``-d`` - launch rviz visualization. If not specified, it does not launch rviz visualization. If specified, it launches rviz visualization with `config/tf_visualization.rviz` configuration.
30-
* ``-e <estimator type>`` - estimator type. Default is ``ground_truth``. Available options: ``ground_truth``, ``raw_odometry``, ``raw_odometry_gps``. It uses configuration from ``config/state_estimator*.yaml``.
31-
* ``-r`` - record rosbag. Default is disabled. If specified, it records rosbag in ``rosbag`` directory.
32-
* ``-t`` - launch keyboard teleoperation. Default is disabled. If specified, it launches keyboard teleoperation.
27+
To launch the Aerostack2 components, execute the following command:
3328

29+
.. code-block:: bash
3430
35-
.. _project_multirotor_simulator_simulated_single_drone:
31+
./launch_as2.bash
3632
37-
Single drone
38-
============
3933
40-
In order to launch the components for a **single drone**, do:
34+
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:
4135

42-
.. code-block:: bash
36+
- ``-c``: motion controller plugin (pid_speed_controller, differential_flatness_controller), choices: [pid, df]. Default: pid
37+
- ``-m``: multi agent. Default not set
38+
- ``-n``: select drones namespace to launch, values are comma separated. By default, it will get all drones from world description file
39+
- ``-g``: launch using gnome-terminal instead of tmux. Default not set
4340

44-
./launch_as2.bash -d -t
41+
Launching Ground Station
42+
========================
4543

46-
This will open a simulation for a single drone alongside the Aerostack2 components necessary for the mission execution.
47-
A window with RViz (argument ``-d``) should popup.
44+
To launch the ground station, execute the following command:
4845

46+
.. code-block:: bash
4947
50-
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>`.
51-
52-
A window like the following image should popup:
48+
./launch_ground_station.bash
5349
54-
.. figure:: images/keyboard_teleop_view.png
55-
:scale: 50
56-
:class: with-shadow
57-
58-
Keyboard teleoperation
50+
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:
5951

60-
To start the mission, execute:
52+
- ``-m``: multi agent. Default not set
53+
- ``-t``: launch keyboard teleoperation. Default not launch
54+
- ``-v``: open rviz. Default launch
55+
- ``-r``: record rosbag. Default not launch
56+
- ``-n``: drone namespaces, comma separated. Default get from world description config file
57+
- ``-g``: launch using gnome-terminal instead of tmux. Default not set
6158

62-
.. code-block:: bash
6359

64-
python3 mission.py
60+
Closing
61+
=======
6562

66-
Also, you can try the mission planner, which describes the mission in a JSON format:
63+
Close all nodes (aerostack2 and ground_station) with the following command executing outside the tmux session:
6764

6865
.. code-block:: bash
6966
70-
python3 mission_planner.py
67+
./stop.bash
7168
69+
.. note::
7270

73-
To do a clean exit of tmux, execute:
71+
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.
7472

75-
.. code-block:: bash
73+
If launcher was executed with the flag ``-g``, closing should be done manually exiting all gnome-terminal tabs.
7674

77-
./stop.bash
7875

76+
.. _project_ms_mission:
7977

78+
-----------------
79+
Mission execution
80+
-----------------
8081

81-
.. _project_multirotor_simulator_simulated_swarm_drones:
82+
The project offers a few examples of mission execution.
8283

83-
Swarm drones
84-
============
84+
- **Keyboard Teleoperation control**: Using reactive teleoperation control. For both single and multiagent swarms.
85+
- **Python API missions**: Using Aerostack2 python API for mission definition. For single drone, using GPS and multiple drones.
86+
- **Behavior Tree missions**: Using Behavior Tree as the mission planner. For single drone only.
87+
- **Mission Interpreter**: Using Aerostack2 mission interpreter. For single drone only.
8588

86-
In order to launch the components for a **swarm of 3 drones**, do:
8789

88-
.. code-block:: bash
90+
.. _project_ms_keyboard_teleoperation:
8991

90-
./launch_as2.bash -m -t -d
92+
Keyboard Teleoperation control
93+
==============================
9194

92-
This will open a simulation for a swarm of drones (argument ``-m``) alongside the Aerostack2 components necessary for the mission execution.
93-
A window with RViz (argument ``-d``) should popup.
95+
In order to launch the components for a **single drone**, Aerostack2 launcher does not need any additional flags. Just execute ``./launch_as2.bash``.
96+
This will launch the Aerostack2 components necessary for the mission execution.
9497

95-
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>`.
98+
.. figure:: images/multirotor_simulator.png
99+
:scale: 50
100+
:class: with-shadow
101+
102+
Multirotor Simulator simulator
96103

97-
A window like the following image should popup:
104+
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.
105+
A window containing the teleoperation widget should pop up:
98106

99-
.. figure:: images/keyboard_swarm_view.png
107+
.. figure:: images/keyboard_teleop_view.png
100108
:scale: 50
101109
:class: with-shadow
102110

103111
Keyboard teleoperation
104112

105-
To start the mission, execute:
113+
.. note::
106114

107-
.. code-block:: bash
115+
The teleoperation widget is also available for multi drone missions. To launch a multi drone simulation, use the flag ``-m`` in both launch commands.
108116

109-
python3 mission_swarm.py
110117

111-
To do a clean exit of tmux, execute the following command with the list of the used drones:
118+
.. _project_ms_python_api:
112119

113-
.. code-block:: bash
120+
Python API missions
121+
===================
122+
123+
In order to launch the components for **multiple drones**, both launchers require the flag ``-m``.
124+
This will launch the Aerostack2 components necessary for the mission execution.
125+
126+
.. figure:: images/multirotor_simulator_swarm.png
127+
:scale: 50
128+
:class: with-shadow
129+
130+
Multirotor Simulator simulator
131+
132+
There are three python scripts available for mission execution in the project. For single drone missions, use ``python3 mission.py`` for flying a square.
133+
When flying using GPS, use ``python3 mission_gps.py`` which will fly a square using GPS waypoints.
134+
135+
For multi drone missions, use ``python3 mission_swarm.py`` where a group of drones will fly a swarm coreography.
136+
137+
.. note::
138+
139+
To understand how missions are built using the Aerostack2 python API, take a look at the :ref:`development_guide_api_python_api` reference guide.
140+
141+
142+
.. _project_ms_mission_interpreter:
143+
144+
Mission Interpreter
145+
===================
146+
147+
Previous missions were defined using python syntaxis. Aerostask2 offers a mission interpreter that allows mission definition using a JSON format.
148+
Currently, the mission interpreter script at the project is only available for single drone missions.
149+
To launch the mission interpreter, execute ``python3 mission_interpreter.py``.
150+
The execution is similar to the python API mission where the drone will fly a square.
151+
152+
153+
.. _project_ms_behavior_tree:
154+
155+
Behavior Tree
156+
=============
157+
158+
Missions can also be defined using a behavior tree. The project offers a mission example using a behavior tree for a single drone.
159+
To launch the behavior tree mission, execute ``python3 mission_behavior_tree.py``.
160+
The execution is similar to the python API mission where the drone will fly a square.
161+
162+
.. note::
114163

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

0 commit comments

Comments
 (0)