Skip to content

Commit 4019e09

Browse files
author
Henry Kotzé
authored
LTA Dynamics System (#2241)
This adds the dynamics to simulate a lighter-than-air vehicle such as blimps/airships. The modelling is based on [1] and [2]. Previously we added an airship-dynamics-plugin to Gazebo-Classic for [PX4 Gazebo SITL](PX4/PX4-SITL_gazebo-classic#490) , but we suffered simulation instability similar to that of the underwater-vehicles since Gazebo-Classic could not simulate the Added Mass dynamics. This PR brings that airship-dynamics-plugin to Gazebo which supports the Added Mass dynamics. Furthermore, I have extended, the Link class to provide access to the AddedMassMatrix, to allow the lighter-than-air system to easily access this matrix. The code is somewhat based of the Hydrodynamics system. I have an STL file which I can contribute, which is an envelope from [Wind Reiter](https://www.windreiter.com/shop/sb-324-300/), and the coefficients in the integrations test is for this envelope model. ### Citations [1] Li, Y., & Nahon, M. (2007). Modeling and simulation of airship dynamics. Journal of Guidance, Control, and Dynamics, 30(6), 1691–1700. [2] Li, Y., Nahon, M., & Sharf, I. (2011). Airship dynamics modeling: A literature review. Progress in Aerospace Sciences, 47(3), 217–239. Signed-off-by: henrykotze <henry@flycloudline.com>
1 parent 8bad6f1 commit 4019e09

File tree

10 files changed

+1234
-0
lines changed

10 files changed

+1234
-0
lines changed
+78
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
<?xml version="1.0" ?>
2+
<sdf version="1.6">
3+
<world name="blimp">
4+
5+
<physics name="1ms" type="ode">
6+
<max_step_size>0.001</max_step_size>
7+
<!-- Zero to run as fast as possible -->
8+
<real_time_factor>1</real_time_factor>
9+
</physics>
10+
11+
<gravity>0 0 -9.81</gravity>
12+
13+
<plugin
14+
filename="gz-sim-physics-system"
15+
name="gz::sim::systems::Physics">
16+
</plugin>
17+
<plugin
18+
filename="gz-sim-user-commands-system"
19+
name="gz::sim::systems::UserCommands">
20+
</plugin>
21+
<plugin
22+
filename="gz-sim-scene-broadcaster-system"
23+
name="gz::sim::systems::SceneBroadcaster">
24+
</plugin>
25+
26+
<plugin
27+
filename="gz-sim-buoyancy-system"
28+
name="gz::sim::systems::Buoyancy">
29+
<uniform_fluid_density>1.097</uniform_fluid_density>
30+
</plugin>
31+
32+
<light type="directional" name="sun">
33+
<cast_shadows>true</cast_shadows>
34+
<pose>0 0 10 0 0 0</pose>
35+
<diffuse>1 1 1 1</diffuse>
36+
<specular>0.5 0.5 0.5 1</specular>
37+
<attenuation>
38+
<range>1000</range>
39+
<constant>0.9</constant>
40+
<linear>0.01</linear>
41+
<quadratic>0.001</quadratic>
42+
</attenuation>
43+
<direction>-0.5 0.1 -0.9</direction>
44+
</light>
45+
46+
<model name="ground_plane">
47+
<static>true</static>
48+
<link name="link">
49+
<collision name="collision">
50+
<geometry>
51+
<plane>
52+
<normal>0 0 1</normal>
53+
<size>100 100</size>
54+
</plane>
55+
</geometry>
56+
</collision>
57+
<visual name="visual">
58+
<geometry>
59+
<plane>
60+
<normal>0 0 1</normal>
61+
<size>100 100</size>
62+
</plane>
63+
</geometry>
64+
<material>
65+
<ambient>0.8 0.8 0.8 1</ambient>
66+
<diffuse>0.8 0.8 0.8 1</diffuse>
67+
<specular>0.8 0.8 0.8 1</specular>
68+
</material>
69+
</visual>
70+
</link>
71+
</model>
72+
<include>
73+
<uri>
74+
https://fuel.gazebosim.org/1.0/hkotze/models/airship
75+
</uri>
76+
</include>
77+
</world>
78+
</sdf>

include/gz/sim/Link.hh

+9
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
#include <vector>
2424

2525
#include <gz/math/Matrix3.hh>
26+
#include <gz/math/Matrix6.hh>
2627
#include <gz/math/Pose3.hh>
2728
#include <gz/math/Quaternion.hh>
2829
#include <gz/math/Vector3.hh>
@@ -269,6 +270,14 @@ namespace gz
269270
public: std::optional<math::Matrix3d> WorldInertiaMatrix(
270271
const EntityComponentManager &_ecm) const;
271272

273+
/// \brief Get the fluid added mass matrix in the world frame.
274+
/// \param[in] _ecm Entity-component manager.
275+
/// \return Fluide added matrix in world frame, returns nullopt if link
276+
/// does not have components components::Inertial and
277+
/// components::WorldPose.
278+
public: std::optional<math::Matrix6d> WorldFluidAddedMassMatrix(
279+
const EntityComponentManager &_ecm) const;
280+
272281
/// \brief Get the rotational and translational kinetic energy of the
273282
/// link with respect to the world frame.
274283
/// \param[in] _ecm Entity-component manager.

src/Link.cc

+12
Original file line numberDiff line numberDiff line change
@@ -337,6 +337,18 @@ std::optional<math::Matrix3d> Link::WorldInertiaMatrix(
337337
math::Inertiald(inertial->Data().MassMatrix(), comWorldPose).Moi());
338338
}
339339

340+
std::optional<math::Matrix6d> Link::WorldFluidAddedMassMatrix(
341+
const EntityComponentManager &_ecm) const
342+
{
343+
auto inertial = _ecm.Component<components::Inertial>(this->dataPtr->id);
344+
auto worldPose = _ecm.Component<components::WorldPose>(this->dataPtr->id);
345+
346+
if (!worldPose || !inertial)
347+
return std::nullopt;
348+
349+
return inertial->Data().FluidAddedMass();
350+
}
351+
340352
//////////////////////////////////////////////////
341353
std::optional<double> Link::WorldKineticEnergy(
342354
const EntityComponentManager &_ecm) const

src/systems/CMakeLists.txt

+1
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,7 @@ add_subdirectory(joint_traj_control)
129129
add_subdirectory(kinetic_energy_monitor)
130130
add_subdirectory(label)
131131
add_subdirectory(lift_drag)
132+
add_subdirectory(lighter_than_air_dynamics)
132133
add_subdirectory(log)
133134
add_subdirectory(log_video_recorder)
134135
add_subdirectory(logical_audio_sensor_plugin)
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
gz_add_system(lighter_than_air_dynamics
2+
SOURCES
3+
LighterThanAirDynamics.cc
4+
PUBLIC_LINK_LIBS
5+
gz-common${GZ_COMMON_VER}::gz-common${GZ_COMMON_VER}
6+
gz-math${GZ_MATH_VER}::eigen3
7+
)

0 commit comments

Comments
 (0)