mirror of
https://github.com/paparazzi/paparazzi.git
synced 2026-06-02 05:17:03 +08:00
Set Gazebo world in flight plan (#2172)
* update documentation * include flight_plan.h in nps_fdm_gazebo.cpp
This commit is contained in:
committed by
Gautier Hattenberger
parent
3f10a79d51
commit
85c2b23c9f
+93
-68
@@ -9,75 +9,100 @@
|
|||||||
Usage:
|
Usage:
|
||||||
1. Make sure gazebo 7 or 8 is installed. (sudo apt-get install gazebo8 libgazebo8-dev)
|
1. Make sure gazebo 7 or 8 is installed. (sudo apt-get install gazebo8 libgazebo8-dev)
|
||||||
2. Prepare the Gazebo world and model:
|
2. Prepare the Gazebo world and model:
|
||||||
a) Prepare the UAV model (see conf/simulator/gazebo/models/ardrone/):
|
1. Prepare the UAV model (see conf/simulator/gazebo/models/ardrone/):
|
||||||
Place the aircraft model in the conf/simulator/gazebo/models/
|
- Place the aircraft model in the conf/simulator/gazebo/models/
|
||||||
folder, this folder is added to Gazebo's search path when NPS is
|
folder, this folder is added to Gazebo's search path when NPS is
|
||||||
launched.
|
launched.
|
||||||
Gazebo uses a Front, Left, Up coordinate system for aircraft, so
|
- Gazebo uses a Front, Left, Up coordinate system for aircraft, so
|
||||||
make sure the +x axis points forwards.
|
make sure the +x axis points forwards.
|
||||||
The model should include a link for each motor with the same names
|
- The model should include a link for each motor with the same names
|
||||||
as those listed in NPS_ACTUATOR_NAMES (see below), e.g. 'nw_motor'.
|
as those listed in NPS_ACTUATOR_NAMES (see below), e.g. 'nw_motor'.
|
||||||
Camera links should have the name specified in .dev_name in the
|
- Camera links should have the name specified in .dev_name in the
|
||||||
corresponding video_config_t struct, see sw/airborne/boards/pc_sim.h
|
corresponding video_config_t struct, see sw/airborne/boards/pc_sim.h
|
||||||
and sw/airborne/modules/computer_vision/video_thread_nps.c.
|
and sw/airborne/modules/computer_vision/video_thread_nps.c.
|
||||||
b) Prepare the world (see conf/simulator/gazebo/worlds/ardrone.world).
|
2. Prepare the world (see conf/simulator/gazebo/worlds/ardrone.world).
|
||||||
Pay attention to the following:
|
Pay attention to the following:
|
||||||
The real-time update rate should be set to zero, as this is
|
- The real-time update rate should be set to zero, as this is
|
||||||
already handled by Paparazzi:
|
already handled by Paparazzi:
|
||||||
<physics type="ode">
|
@code{.xml}
|
||||||
<max_step_size>0.001</max_step_size>
|
<physics type="ode">
|
||||||
<real_time_update_rate>0</real_time_update_rate><!-- Handled by Paparazzi! -->
|
<max_step_size>0.001</max_step_size>
|
||||||
</physics>
|
<real_time_update_rate>0</real_time_update_rate><!-- Handled by Paparazzi! -->
|
||||||
Spherical coordinates should be provided for navigation.
|
</physics>
|
||||||
At this moment, there is an issue where Gazebo incorrectly
|
@endcode
|
||||||
uses a WSU coordinate system instead of ENU. This can be fixed
|
- Spherical coordinates should be provided for navigation.
|
||||||
by setting the heading to 180 degrees as shown below:
|
At this moment, there is an issue where Gazebo incorrectly
|
||||||
<spherical_coordinates>
|
uses a WSU coordinate system instead of ENU. This can be fixed
|
||||||
<surface_model>EARTH_WGS84</surface_model>
|
by setting the heading to 180 degrees as shown below:
|
||||||
<latitude_deg>51.9906</latitude_deg>
|
@code{.xml}
|
||||||
<longitude_deg>4.37679</longitude_deg>
|
<spherical_coordinates>
|
||||||
<elevation>0</elevation>
|
<surface_model>EARTH_WGS84</surface_model>
|
||||||
<heading_deg>180</heading_deg><!-- Temporary fix for issue https://bitbucket.org/osrf/gazebo/issues/2022/default-sphericalcoordinates-frame-should -->
|
<latitude_deg>51.9906</latitude_deg>
|
||||||
</spherical_coordinates>
|
<longitude_deg>4.37679</longitude_deg>
|
||||||
|
<elevation>0</elevation>
|
||||||
|
<heading_deg>180</heading_deg><!-- Temporary fix for issue https://bitbucket.org/osrf/gazebo/issues/2022/default-sphericalcoordinates-frame-should -->
|
||||||
|
</spherical_coordinates>
|
||||||
|
@endcode
|
||||||
3. Prepare the airframe file (see examples/ardrone2_gazebo.xml):
|
3. Prepare the airframe file (see examples/ardrone2_gazebo.xml):
|
||||||
a) Select Gazebo as the FDM (Flight Dynamics Model)
|
1. Select Gazebo as the FDM (Flight Dynamics Model)
|
||||||
<target name="nps" board="pc">
|
@code{.xml}
|
||||||
<module name="fdm" type="gazebo"/>
|
<target name="nps" board="pc">
|
||||||
</target>
|
<module name="fdm" type="gazebo"/>
|
||||||
b) Add actuator thrusts and torques to the SIMULATOR section:
|
</target>
|
||||||
<section name="SIMULATOR" prefix="NPS_">
|
@endcode
|
||||||
<define name="ACTUATOR_NAMES" value="nw_motor, ne_motor, se_motor, sw_motor" type="string[]"/>
|
2. Add actuator thrusts and torques to the SIMULATOR section:
|
||||||
<define name="ACTUATOR_THRUSTS" value="1.55, 1.55, 1.55, 1.55" type="float[]"/>
|
@code{.xml}
|
||||||
<define name="ACTUATOR_TORQUES" value="0.155, -0.155, 0.155, -0.155" type="float[]"/>
|
<section name="SIMULATOR" prefix="NPS_">
|
||||||
...
|
<define name="ACTUATOR_NAMES" value="nw_motor, ne_motor, se_motor, sw_motor" type="string[]"/>
|
||||||
<section>
|
<define name="ACTUATOR_THRUSTS" value="1.55, 1.55, 1.55, 1.55" type="float[]"/>
|
||||||
The thrusts and torques are expressed in SI units (N, Nm) and should
|
<define name="ACTUATOR_TORQUES" value="0.155, -0.155, 0.155, -0.155" type="float[]"/>
|
||||||
be in the same order as the ACTUATOR_NAMES.
|
...
|
||||||
c) In the same section, bypass the AHRS and INS as these are not
|
<section>
|
||||||
supported yet:
|
@endcode
|
||||||
<section name="SIMULATOR" prefix="NPS_">
|
The thrusts and torques are expressed in SI units (N, Nm) and should
|
||||||
...
|
be in the same order as the ACTUATOR_NAMES.
|
||||||
<define name="BYPASS_AHRS" value="1"/>
|
3. In the same section, bypass the AHRS and INS as these are not
|
||||||
<define name="BYPASS_INS" value="1"/>
|
supported yet:
|
||||||
...
|
@code{.xml}
|
||||||
<section>
|
<section name="SIMULATOR" prefix="NPS_">
|
||||||
d) If required, enable video thread simulation:
|
...
|
||||||
<section name="SIMULATOR" prefix="NPS_">
|
<define name="BYPASS_AHRS" value="1"/>
|
||||||
...
|
<define name="BYPASS_INS" value="1"/>
|
||||||
<define name="SIMULATE_VIDEO" value="1"/>
|
...
|
||||||
...
|
</section>
|
||||||
<section>
|
@endcode
|
||||||
e) If required, specify the Gazebo world and aircraft name:
|
4. If required, enable video thread simulation:
|
||||||
<section name="SIMULATOR" prefix="NPS_">
|
@code{.xml}
|
||||||
...
|
<section name="SIMULATOR" prefix="NPS_">
|
||||||
<define name="GAZEBO_WORLD" value="my_world.world"/>
|
...
|
||||||
<define name="GAZEBO_AC_NAME" value="my_uav"/>
|
<define name="SIMULATE_VIDEO" value="1"/>
|
||||||
<section>
|
...
|
||||||
4. Make sure all included modules work with nps. At the moment, most of
|
</section>
|
||||||
the modules that depend on video_thread are only built when ap is
|
@endcode
|
||||||
selected as the target. As a quick fix, try to remove the target
|
5. If required, set the aircraft model in the airframe file:
|
||||||
attribute from the makefile element in the module xml, e.g.:
|
@code{.xml}
|
||||||
<makefile target="ap"> ---> <makefile>
|
<section name="SIMULATOR" prefix="NPS_">
|
||||||
|
...
|
||||||
|
<define name="GAZEBO_AC_NAME" value="my_uav"/>
|
||||||
|
</section>
|
||||||
|
@endcode
|
||||||
|
6. Make sure all included modules work with nps. At the moment, most of
|
||||||
|
the modules that depend on video_thread are only built when ap is
|
||||||
|
selected as the target. To fix this, add nps to the target attribute
|
||||||
|
in the module xml, e.g.:
|
||||||
|
@code{.xml}
|
||||||
|
<makefile target="ap|nps">
|
||||||
|
@endcode
|
||||||
|
4. If required, set the simulation environment in the flight plan file:
|
||||||
|
@code{.xml}
|
||||||
|
<flight_plan ...>
|
||||||
|
<header>
|
||||||
|
...
|
||||||
|
#define NPS_GAZEBO_WORLD "my.world"
|
||||||
|
</header>
|
||||||
|
...
|
||||||
|
<flight_plan>
|
||||||
|
@endcode
|
||||||
</description>
|
</description>
|
||||||
</doc>
|
</doc>
|
||||||
<header/>
|
<header/>
|
||||||
|
|||||||
@@ -51,6 +51,7 @@ extern "C" {
|
|||||||
#include "nps_autopilot.h"
|
#include "nps_autopilot.h"
|
||||||
|
|
||||||
#include "generated/airframe.h"
|
#include "generated/airframe.h"
|
||||||
|
#include "generated/flight_plan.h"
|
||||||
#include "autopilot.h"
|
#include "autopilot.h"
|
||||||
|
|
||||||
#include "math/pprz_isa.h"
|
#include "math/pprz_isa.h"
|
||||||
|
|||||||
Reference in New Issue
Block a user