[gazebo] Add actuator dynamics and bebop model (#2219)

* Add gazebo model for Parrot Bebop 1

* Add first-order high pass filter

* First implementation of actuator dynamics and spinup torque

Flies ok with PID control

Does not fly ok with INDI, the required G1 R is 0.159 instead of
0.0022 (estimated by flying in adaptive mode). The other parameters
are close to those specified in the airframe file.

* FIX incorrect yaw behavior

Fixed two bugs:
1. gazebo_actuators.torques was set to NPS_ACTUATOR_THRUSTS
2. spinup torque direction is now also controlled by motor mixing

* Clean up debug code and file logger

* Clean up gazebo example airframes

* Minor cleanup

* FIX warnings about missing initializer in fdm_gazebo

* Update documentation

* Remove modules section, move to firmware

* Minor fixes to fdm_gazebo and high_pass_filter

* Move actuator dynamics to included airframe files

Should prevent duplicate actuator defines spread accross all
airframe files.

* Fix FILTER_ROLL_RATE in bebop2_indi airframe

Moved to firmware targets so it will be disabled in gazebo.
Is this actually working in jsbsim??

* Update documentation

* Fix newlines

* Minor fixes in nps_fdm_gazebo.cpp

* Re-enable filter roll rate

Caution: causes oscillations around roll axis in gazebo

* Disable roll filter and cleanup
This commit is contained in:
Tom van Dijk
2018-01-30 16:39:18 +01:00
committed by Kirk Scheper
parent 2d86a0b60a
commit cfabb51eed
11 changed files with 477 additions and 61 deletions
+60 -34
View File
@@ -50,50 +50,76 @@
<module name="fdm" type="gazebo"/>
</target>
@endcode
2. Add actuator thrusts and torques to the SIMULATOR section:
2. Include the gazebo defines for the vehicle:
@code{.xml}
<section name="SIMULATOR" prefix="NPS_">
<define name="ACTUATOR_NAMES" value="nw_motor, ne_motor, se_motor, sw_motor" type="string[]"/>
<define name="ACTUATOR_THRUSTS" value="1.55, 1.55, 1.55, 1.55" type="float[]"/>
<define name="ACTUATOR_TORQUES" value="0.155, -0.155, 0.155, -0.155" type="float[]"/>
...
<section>
@endcode
The thrusts and torques are expressed in SI units (N, Nm) and should
be in the same order as the ACTUATOR_NAMES.
3. In the same section, bypass the AHRS and INS as these are not
supported yet:
@code{.xml}
<section name="SIMULATOR" prefix="NPS_">
...
<define name="BYPASS_AHRS" value="1"/>
<define name="BYPASS_INS" value="1"/>
...
</section>
<include href="conf/simulator/gazebo/airframes/ardrone2.xml"/>
@endcode
4. If required, enable video thread simulation:
@code{.xml}
<section name="SIMULATOR" prefix="NPS_">
...
<define name="SIMULATE_VIDEO" value="1"/>
...
</section>
@endcode
5. If required, set the aircraft model in the airframe file:
@code{.xml}
<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
- If conf/simulator/gazebo/airframes does not contain an xml for the
vehicle model, it should be created with the following contents:
1. Actuator thrusts and torques
@code{.xml}
<!DOCTYPE airframe SYSTEM "../../../airframes/airframe.dtd">
<airframe>
<section name="SIMULATOR" prefix="NPS_">
<define name="ACTUATOR_THRUSTS" value="1.55, 1.55, 1.55, 1.55" type="float[]"/>
<define name="ACTUATOR_TORQUES" value="0.155, 0.155, 0.155, 0.155" type="float[]"/>
...
</section>
</airframe>
@endcode
The thrusts and torques are expressed in SI units (N, Nm) and should
be in the same order as the ACTUATOR_NAMES defined in the airframe file.
The torque direction is determined automatically from the motor mixing.
2. (Optional) Add actuator dynamics to the SIMULATOR section:
@code{.xml}
<section name="SIMULATOR" prefix="NPS_">
...
<define name="ACTUATOR_TIME_CONSTANTS" value="0.02, 0.02, 0.02, 0.02" type="float[]"/>
<define name="ACTUATOR_MAX_ANGULAR_MOMENTUM" value="0.19, 0.19, 0.19, 0.19" type="float[]"/>
...
</section>
@endcode
Actuator time constants can be provided without specifying the
actuator's maximum angular momentum. If the maximum angular momentum
is provided as well, it is used to calculate the rotor spin-up torque.
3. In the same section, bypass the AHRS and INS as these are not
supported yet:
@code{.xml}
<section name="SIMULATOR" prefix="NPS_">
...
<define name="BYPASS_AHRS" value="1"/>
<define name="BYPASS_INS" value="1"/>
...
</section>
@endcode
4. If required, enable video thread simulation:
@code{.xml}
<section name="SIMULATOR" prefix="NPS_">
...
<define name="SIMULATE_VIDEO" value="1"/>
...
</section>
@endcode
5. Set the aircraft model in the xml file:
@code{.xml}
<section name="SIMULATOR" prefix="NPS_">
...
<define name="GAZEBO_AC_NAME" value="my_uav"/>
</section>
@endcode
3. 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:
4. The simulation environment is set in the flight plan file:
@code{.xml}
<flight_plan ...>
<header>
@@ -101,7 +127,7 @@
#define NPS_GAZEBO_WORLD "my.world"
</header>
...
<flight_plan>
</flight_plan>
@endcode
</description>
<configure name="NPS_DEBUG_VIDEO" value="0|1" description="show window with video for debugging"/>