Skip to content

Commit 679da4c

Browse files
committedApr 22, 2024·
Add multirotor simulator
1 parent f2bfc5a commit 679da4c

File tree

9 files changed

+334
-0
lines changed

9 files changed

+334
-0
lines changed
 
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
.. _examples_multirotor_simulator:
2+
3+
====================
4+
Multirotor Simulator
5+
====================
6+
7+
These examples use the :ref:`Multirotor Simulator Platform <aerial_platform_multirotor_simulator>`.
8+
You can install it following the instructions in :ref:`installation section <aerial_platform_multirotor_simulator>`.
9+
10+
.. figure:: resources/multirotor_simulator_main.png
11+
:scale: 50
12+
:class: with-shadow
13+
14+
.. raw:: html
15+
16+
<h2>List of examples based on Multirotor Simulator</h2>
17+
18+
---------------------
19+
20+
.. toctree::
21+
:maxdepth: 1
22+
23+
project_multirotor_simulator/index.rst
Loading
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,115 @@
1+
.. _project_multirotor_simulator:
2+
3+
============================
4+
Multirotor Simulator Example
5+
============================
6+
7+
To install this project, clone the repository:
8+
9+
.. code-block:: bash
10+
11+
git clone https://github.com/aerostack2/project_as2_multirotor_simulator
12+
13+
To start using this project, please go to the root folder of the project.
14+
15+
16+
17+
.. _project_multirotor_simulator_simulated:
18+
19+
---------
20+
Execution
21+
---------
22+
23+
The execution will launch the Aerostack2 components.
24+
25+
The flags for the components launcher are:
26+
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.
33+
34+
35+
.. _project_multirotor_simulator_simulated_single_drone:
36+
37+
Single drone
38+
============
39+
40+
In order to launch the components for a **single drone**, do:
41+
42+
.. code-block:: bash
43+
44+
./launch_as2.bash -d -t
45+
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.
48+
49+
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:
53+
54+
.. figure:: images/keyboard_teleop_view.png
55+
:scale: 50
56+
:class: with-shadow
57+
58+
Keyboard teleoperation
59+
60+
To start the mission, execute:
61+
62+
.. code-block:: bash
63+
64+
python3 mission.py
65+
66+
Also, you can try the mission planner, which describes the mission in a JSON format:
67+
68+
.. code-block:: bash
69+
70+
python3 mission_planner.py
71+
72+
73+
To do a clean exit of tmux, execute:
74+
75+
.. code-block:: bash
76+
77+
./stop.bash
78+
79+
80+
81+
.. _project_multirotor_simulator_simulated_swarm_drones:
82+
83+
Swarm drones
84+
============
85+
86+
In order to launch the components for a **swarm of 3 drones**, do:
87+
88+
.. code-block:: bash
89+
90+
./launch_as2.bash -m -t -d
91+
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.
94+
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>`.
96+
97+
A window like the following image should popup:
98+
99+
.. figure:: images/keyboard_swarm_view.png
100+
:scale: 50
101+
:class: with-shadow
102+
103+
Keyboard teleoperation
104+
105+
To start the mission, execute:
106+
107+
.. code-block:: bash
108+
109+
python3 mission_swarm.py
110+
111+
To do a clean exit of tmux, execute the following command with the list of the used drones:
112+
113+
.. code-block:: bash
114+
115+
./stop.bash drone0 drone1 drone2
Loading
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,195 @@
1+
.. _aerial_platform_multirotor_simulator:
2+
3+
====================
4+
Multirotor Simulator
5+
====================
6+
7+
.. contents:: Table of Contents
8+
:depth: 3
9+
:local:
10+
11+
12+
13+
.. _aerial_platform_multirotor_simulator_introduction:
14+
15+
------------
16+
Introduction
17+
------------
18+
19+
For simulation purposes with `Multirotor simulator <https://github.com/RPS98/multirotor_simulator>`__ , Aerostack2 provides with a platform that serves as an entry point for aerial robotics simulated in this environment.
20+
21+
22+
.. _aerial_platform_multirotor_simulator_installation:
23+
24+
------------
25+
Installation
26+
------------
27+
28+
* For binary installation, install by running:
29+
30+
.. code-block:: bash
31+
32+
sudo apt install ros-humble-as2-platform-multirotor-simulator
33+
34+
.. warning:: This package is available for aerostack2 v1.1 and onwards.
35+
36+
* For source installation, clone Aerostack2 repository into your workspace and build it. See it in :ref:`Aerostack2 installation guide <getting_started_ubuntu_installation_source>`.
37+
38+
39+
40+
41+
.. _aerial_platform_multirotor_simulator_as2_common_interface:
42+
43+
---------------------------
44+
Aerostack2 Common Interface
45+
---------------------------
46+
47+
For more details about platform control modes and sensors, see :ref:`Aerostack2 Aerial Platform Concepts <as2_concepts_aerial_platform>`.
48+
49+
50+
51+
.. _aerial_platform_multirotor_simulator_as2_common_interface_control_modes:
52+
53+
Control Modes
54+
=============
55+
56+
These are supported control modes:
57+
58+
.. list-table:: Control Modes Multirotor Simulator Platform
59+
:widths: 50 50 50
60+
:header-rows: 1
61+
62+
* - Control Mode
63+
- Yaw Mode
64+
- Reference Frame
65+
* - Hover
66+
- None
67+
- None
68+
* - Position
69+
- Angle
70+
- ENU
71+
* - Position
72+
- Speed
73+
- ENU
74+
* - Speed
75+
- Angle
76+
- ENU
77+
* - Speed
78+
- Speed
79+
- ENU
80+
* - Trajectory
81+
- Angle
82+
- ENU
83+
* - Trajectory
84+
- Speed
85+
- ENU
86+
* - Acro
87+
- None
88+
- None
89+
90+
91+
.. _aerial_platform_multirotor_simulator_as2_common_interface_sensors:
92+
93+
Sensors
94+
=======
95+
96+
These are supported sensors:
97+
98+
.. list-table:: Sensors Multirotor Simulator Platform
99+
:widths: 50 50 50
100+
:header-rows: 1
101+
102+
* - Sensor
103+
- Topic
104+
- Type
105+
* - IMU
106+
- sensor_measurements/imu
107+
- sensor_msgs/msg/Imu
108+
* - GPS
109+
- sensor_measurements/gps
110+
- sensor_msgs/msg/NavSatFix
111+
112+
Gimbal
113+
======
114+
115+
Gimbal is supported in simulation. These are the supported gimbal model types:
116+
117+
.. list-table:: Gimbal Control Modes Multirotor Simulator Platform
118+
:widths: 50 50 50 50
119+
:header-rows: 1
120+
121+
* - Gimbal type
122+
- Topic
123+
- Type
124+
- Control mode id
125+
* - gimbal_position
126+
- platform/{gimbal_name}/gimbal_command
127+
- as2_msgs/msg/GimbalControl
128+
- "0"
129+
130+
Gimbal state is published in the following topics:
131+
132+
.. list-table:: Gimbal State Multirotor Simulator Platform
133+
:widths: 50 50
134+
:header-rows: 1
135+
136+
* - Topic
137+
- Type
138+
* - sensor_measurements/{gimbal_name}
139+
- geometry_msgs/msg/PoseStamped
140+
141+
.. _aerial_platform_multirotor_simulator_config_simulation:
142+
143+
-----------------
144+
Config Simulation
145+
-----------------
146+
147+
Configuration files are located in ``as2_platform_multirotor_simulator/config/``:
148+
149+
* ``control_modes.yaml``: available input control modes for the aerostack2 aerial platform.
150+
* ``platform_config_file.yaml``: ROS 2 configuration, with tf names, frequencies and aerostack2 parameters.
151+
* ``simulation_config.yaml``: simulation configuration, with frequency and environment parameters.
152+
* ``uav_configuav_config.yaml``: UAV configuration, with the drone's physical parameters and controller configuration.
153+
* ``world_config.yaml``: world configuration, as parameters override for each drone namespace in the configuration file.
154+
155+
156+
.. _aerial_platform_multirotor_simulator_platform_launch:
157+
158+
---------------
159+
Platform Launch
160+
---------------
161+
162+
Aerostack2 Multirotor Simulator platform provides two launch files:
163+
164+
* ``as2_platform_multirotor_simulator.launch.py``: launch the platform with platform configuration file.
165+
* ``as2_platform_multirotor_simulator_world.launch.launch.py``: launch the platform with world configuration file.
166+
167+
You can show launcher parameters by running:
168+
169+
.. code-block:: bash
170+
171+
ros2 launch as2_platform_multirotor_simulator as2_platform_multirotor_simulator.launch..py --show-args
172+
173+
.. code-block:: bash
174+
175+
ros2 launch as2_platform_multirotor_simulator as2_platform_multirotor_simulator_world.launch..py --show-args
176+
177+
178+
Launcher parameters order:
179+
180+
1. Default configuration file in ``as2_platform_multirotor_simulator/config/`` folder.
181+
2. Custom configuration file in the launch command (e.g. *platform_config_file:=path/to/file.yaml*).
182+
3. Custom parameters in the launch command (e.g. *frequency:=100*).
183+
4. Custom world configuration in the launch command (e.g. *world_config:=path/to/file.yaml*), for the world launcher.
184+
185+
Example of launch command:
186+
187+
.. code-block:: bash
188+
189+
ros2 launch as2_platform_multirotor_simulator as2_platform_multirotor_simulator.launch.py namespace:=drone0
190+
191+
For launch the simulation, run the following command:
192+
193+
.. code-block:: bash
194+
195+
ros2 launch as2_platform_multirotor_simulator as2_platform_multirotor_simulator_world.launch.launch.py namespace:=drone0 world_config:=config/world_config.yaml

‎docs/_03_aerial_platforms/index.rst

+1
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ Currently, the following aerial platforms are supported:
1111
.. toctree::
1212
:maxdepth: 2
1313

14+
_multirotor_simulator/index.rst
1415
_gazebo_simulation/index.rst
1516
_pixhawk/index.rst
1617
_crazyflie/index.rst

0 commit comments

Comments
 (0)
Please sign in to comment.