Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Automatic Moment of Inertia Calculations for Basic Shapes #1299

Merged
merged 92 commits into from
Aug 30, 2023
Merged
Show file tree
Hide file tree
Changes from 78 commits
Commits
Show all changes
92 commits
Select commit Hold shift + click to select a range
93e497e
Copy sdf 1.10 to 1.11
jasmeet0915 Jun 13, 2023
bf33df2
Bumped sdf 1.10 to sdf 1.11
jasmeet0915 Jun 19, 2023
9450574
Update SDF schema version in CMakeLists.txt
jasmeet0915 Jun 27, 2023
0841705
Added <material_density> element to <collision
jasmeet0915 Jun 19, 2023
1c27bfc
Added auto attribute to <inertia> tag
jasmeet0915 Jun 19, 2023
8a1f8a7
Added gz::math::Material member to Collision
jasmeet0915 Jun 26, 2023
e3fc2a3
Added MassMatrix() functions to Box, Capsule, Cylinder, Ellipsoid & S…
jasmeet0915 Jul 3, 2023
dbe7d3e
Added MassMatrix() functions to sdf::Geometry class
jasmeet0915 Jul 3, 2023
45a67bd
Replaced gz::math::Material member of sdf::Collision with double density
jasmeet0915 Jul 3, 2023
db76c5f
Added getter setter functions for density in sdf::Collision
jasmeet0915 Jul 3, 2023
7290483
Added MassMatrix() function to sdf::Collision class
jasmeet0915 Jul 3, 2023
c8120ae
Update Link::Load() to check for inertia auto attr & call MassMatrix …
jasmeet0915 Jul 3, 2023
42a4707
Cleaned up the Code
jasmeet0915 Jul 13, 2023
bbacbe9
Corrected default density value
jasmeet0915 Jul 17, 2023
b092904
Corrected function comments
jasmeet0915 Jul 17, 2023
c3c52aa
Changed <material_density> tag to <density>
jasmeet0915 Jul 31, 2023
8ff8726
Updated Collision:MassMatrix() to use gz::math::Inertial object as pa…
jasmeet0915 Jul 13, 2023
0cd267b
Updated Link::Load() to add inertials from multiple collisions
jasmeet0915 Jul 13, 2023
6881c2d
Shifted auto attribute from <inertia> to <inertial>
jasmeet0915 Aug 4, 2023
dd0551a
Added CalculateInertial() function to sdf::Root
jasmeet0915 Aug 7, 2023
8d0c084
Added CalculateInertial() function to sdf::Model
jasmeet0915 Aug 7, 2023
942bf78
Added CalculateInertial() function to sdf::World
jasmeet0915 Aug 7, 2023
1eeed1e
Added CalculateInertial() function to sdf::Link to check for auto and…
jasmeet0915 Aug 7, 2023
b6a8a7b
Update Collision::MassMatrix() to set inertial pose using collision p…
jasmeet0915 Aug 7, 2023
33d9979
Called World::CalculateInertials() in Root::Load() function
jasmeet0915 Aug 8, 2023
76842fe
Added check for no collisions when auto is true & return an Element M…
jasmeet0915 Aug 8, 2023
f486a1b
Used enforcePolicyCondition() to print <density> element missing mess…
jasmeet0915 Aug 10, 2023
429eb2f
Restored original flow of Link::Load() to set inertial values & updat…
jasmeet0915 Aug 10, 2023
b349c0d
Renamed & changed MassMatrix() functions for all shapes to return gz:…
jasmeet0915 Aug 10, 2023
5f11863
Renamed & updated MassMatrix() function for sdf::Geometry to return o…
jasmeet0915 Aug 10, 2023
8214ae6
Renamed & Updated MassMatrix() function of sdf::Collision to use Iner…
jasmeet0915 Aug 10, 2023
0d1e1bc
Updated call to collision inertia calculation function with the new name
jasmeet0915 Aug 10, 2023
b1f7a51
Removed print statements
jasmeet0915 Aug 10, 2023
702dd9f
Completed codecheck
jasmeet0915 Aug 10, 2023
67126dd
Merge branch 'main' into jasmeet/auto_moment_of_inertia
jasmeet0915 Aug 10, 2023
0a6a528
Removed const type qualifier from double density param for CalculateI…
jasmeet0915 Aug 11, 2023
138bdb4
Shifted check for density element from Collision::Load() to Collision…
jasmeet0915 Aug 11, 2023
fa1da0b
Shifted CalculateInertials() call to end of Root:Load()
jasmeet0915 Aug 11, 2023
9c6f8c5
Update CalculateInertials() function in Root, World, Model, Link & Co…
jasmeet0915 Aug 11, 2023
1a483a2
Completed codecheck
jasmeet0915 Aug 11, 2023
2f0c840
Removed const specifier for double density from Geometry & Collision
jasmeet0915 Aug 11, 2023
ac943c6
Corrected function comments
jasmeet0915 Aug 14, 2023
8fef740
Included <optional> header
jasmeet0915 Aug 14, 2023
80e321c
Removed warning for missing <inertial> element
jasmeet0915 Aug 17, 2023
e3041e4
Added warning for overwritting of user given inertial value sif auto …
jasmeet0915 Aug 17, 2023
cc9849c
Removed call to CalculateInertial() from Root::Load()
jasmeet0915 Aug 17, 2023
0e41116
Corrected codecheck
jasmeet0915 Aug 21, 2023
4731e21
Added unit tests for CalculateInertial() function in Box, Capsule, Cy…
jasmeet0915 Aug 22, 2023
3aefdc3
Added unit tests for CalculateInertial() in Geometry
jasmeet0915 Aug 22, 2023
2836be9
Updated construction unit test of Collision with checks for density v…
jasmeet0915 Aug 22, 2023
dbe543f
Updated CalculateInertial() unit test to test for std::nullopt return…
jasmeet0915 Aug 22, 2023
8d459c7
Added unit tests for CalculateInertial() in sdf::Collision
jasmeet0915 Aug 22, 2023
464f7de
Completed codecheck
jasmeet0915 Aug 22, 2023
5af78f7
Merge branch 'main' into jasmeet/auto_moment_of_inertia
jasmeet0915 Aug 22, 2023
485dd84
Added enum class for CalculateInertial() configuration
jasmeet0915 Aug 24, 2023
ca78026
Added check for CalculateInertialConfiguration in Root::Load()
jasmeet0915 Aug 24, 2023
002c643
Renamed CALCULATE_AND_SAVE value to SAVE_CALCULATION in COnfigureCalc…
jasmeet0915 Aug 24, 2023
1688522
Added boolean autoInertiaSaved member to link
jasmeet0915 Aug 24, 2023
230bde2
Added check for autoInertiaSaved & SAVE_CALCULATION configuration in …
jasmeet0915 Aug 24, 2023
0df7eae
Completed codecheck
jasmeet0915 Aug 24, 2023
5b58b11
Merge branch 'main' into jasmeet/auto_moment_of_inertia
jasmeet0915 Aug 24, 2023
dd06f08
Added //inertial/density to the spec
jasmeet0915 Aug 24, 2023
325854c
Updated Geometry::CalculateInertial() to accept density & parser conf…
jasmeet0915 Aug 24, 2023
fc01633
Updated Geometry::CalculateInertial() to give warning when a not supp…
jasmeet0915 Aug 24, 2023
d1e7484
Updated Geometry unit test for not supported geom type
jasmeet0915 Aug 24, 2023
88d5eeb
Updated Collision::ToElement() to set density
jasmeet0915 Aug 24, 2023
0ec1aac
Added unit tests for collision pose relative to some other frame test…
jasmeet0915 Aug 24, 2023
dc30cf9
Completed codecheck
jasmeet0915 Aug 24, 2023
40811cf
Added unit tests for ParserConfig
jasmeet0915 Aug 24, 2023
01c49c4
Added unit tests for Link
jasmeet0915 Aug 24, 2023
b5648ff
Replaced tabs with spaces in sdf string in Link_Test
jasmeet0915 Aug 24, 2023
4a2357a
Updated ParserConfig Unit test to test SetCalculateInertialConfigurat…
jasmeet0915 Aug 24, 2023
60131dd
Added test for CalculateInertial() called with auto set to false
jasmeet0915 Aug 24, 2023
a3cb221
Added unit test for World::CalculateInertial()
jasmeet0915 Aug 24, 2023
7483b89
Added unit test for CalculateInertial() call with SAVE_CALCULATION co…
jasmeet0915 Aug 24, 2023
e772c24
Included missing header files
jasmeet0915 Aug 25, 2023
f3cd3be
Removed redundant sdf/Model.hh include from Collision_TEST
jasmeet0915 Aug 26, 2023
ef8ae18
Merge branch 'main' into jasmeet/auto_moment_of_inertia
jasmeet0915 Aug 27, 2023
16ce852
Updated CalculateInertial() documentation for Box, Capsule, Cylinder,…
jasmeet0915 Aug 28, 2023
65c3703
Updated Collision::Density() & Collision::SetDensity() docs
jasmeet0915 Aug 28, 2023
fee0d90
Updated Root::CalculateInertial() docs
jasmeet0915 Aug 28, 2023
ff88720
Updated description for <density> element in <inertial>
jasmeet0915 Aug 28, 2023
af8052e
Added doc for autoInertiaSaved variable in sdf::Link
jasmeet0915 Aug 28, 2023
943b886
Update function APIs
jasmeet0915 Aug 28, 2023
a658c25
Added flag to track if density was set at load
jasmeet0915 Aug 28, 2023
d652717
Added separate variable to track if auto inertia is enabled or not
jasmeet0915 Aug 28, 2023
ec62766
Completed codecheck
jasmeet0915 Aug 28, 2023
c8f9fc4
Updated Collision::CalculateInertial() API
jasmeet0915 Aug 29, 2023
b05e267
Updated check for geometry type before resolving inertial pose
jasmeet0915 Aug 29, 2023
3a21b69
Updated Root::CalculateInertial() docs
jasmeet0915 Aug 29, 2023
91c828a
Added const specifier to variables where needed
jasmeet0915 Aug 29, 2023
1986cfd
Rename CalculateInertials() API in Root, World, Model & Link
jasmeet0915 Aug 30, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions include/sdf/Box.hh
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,11 @@
#ifndef SDF_BOX_HH_
#define SDF_BOX_HH_

#include <optional>

#include <gz/math/Box.hh>
#include <gz/math/Vector3.hh>
#include <gz/math/Inertial.hh>
#include <gz/utils/ImplPtr.hh>
#include <sdf/Error.hh>
#include <sdf/Element.hh>
Expand Down Expand Up @@ -65,6 +68,12 @@ namespace sdf
/// \return A reference to a gz::math::Boxd object.
public: gz::math::Boxd &Shape();

/// \brief Calculate and return the Mass Matrix values for the Box
azeey marked this conversation as resolved.
Show resolved Hide resolved
/// \param[in] _density Density of the box in kg/m^3
/// \return A std::optional with gz::math::Inertiald object or std::nullopt
public: std::optional<gz::math::Inertiald>
CalculateInertial(double _density);

/// \brief Create and return an SDF element filled with data from this
/// box.
/// Note that parameter passing functionality is not captured with this
Expand Down
9 changes: 9 additions & 0 deletions include/sdf/Capsule.hh
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,10 @@
#ifndef SDF_CAPSULE_HH_
#define SDF_CAPSULE_HH_

#include <optional>

#include <gz/math/Capsule.hh>
#include <gz/math/Inertial.hh>
#include <gz/utils/ImplPtr.hh>
#include <sdf/Error.hh>
#include <sdf/Element.hh>
Expand Down Expand Up @@ -72,6 +75,12 @@ namespace sdf
/// \return A reference to a gz::math::Capsuled object.
public: gz::math::Capsuled &Shape();

/// \brief Calculate and return the Mass Matrix values for the Capsule
/// \param[in] _density Density of the capsule in kg/m^3
/// \return A std::optional with gz::math::Inertiald object or std::nullopt
public: std::optional<gz::math::Inertiald> CalculateInertial(
double _density);

/// \brief Create and return an SDF element filled with data from this
/// capsule.
/// Note that parameter passing functionality is not captured with this
Expand Down
22 changes: 22 additions & 0 deletions include/sdf/Collision.hh
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,15 @@
#include <memory>
#include <string>
#include <gz/math/Pose3.hh>
#include <gz/math/Vector3.hh>
#include <gz/math/Inertial.hh>
#include <gz/utils/ImplPtr.hh>
#include "sdf/Element.hh"
#include "sdf/SemanticPose.hh"
#include "sdf/Types.hh"
#include "sdf/sdf_config.h"
#include "sdf/system_util.hh"
#include "sdf/ParserConfig.hh"

namespace sdf
{
Expand Down Expand Up @@ -75,6 +78,16 @@ namespace sdf
/// \param[in] _name Name of the collision.
public: void SetName(const std::string &_name);

/// \brief Get the density of the collision.
/// The density of the collision must be unique within the scope of a Link.
azeey marked this conversation as resolved.
Show resolved Hide resolved
/// \return Density of the collision.
public: double Density() const;

/// \brief Set the density of the collision.
/// The density of the collision must be unique within the scope of a Link.
/// \param[in] _density Density of the collision.
public: void SetDensity(double _density);

/// \brief Get a pointer to the collisions's geometry.
/// \return The collision's geometry.
public: const Geometry *Geom() const;
Expand Down Expand Up @@ -119,6 +132,15 @@ namespace sdf
/// \return SemanticPose object for this link.
public: sdf::SemanticPose SemanticPose() const;

/// \brief Calculate and return the MassMatrix for the collision
/// \param[out] _inertial An inertial object which will be set with the
/// calculated inertial values
/// \param[in] _config Custom parser configuration
/// \return Errors, which is a vector of Error objects. Each Error includes
/// an error code and message. An empty vector indicates no error
public: Errors CalculateInertial(gz::math::Inertiald &_inertial,
const ParserConfig &_config);
azeey marked this conversation as resolved.
Show resolved Hide resolved

/// \brief Get a pointer to the SDF element that was used during
/// load.
/// \return SDF element pointer. The value will be nullptr if Load has
Expand Down
9 changes: 9 additions & 0 deletions include/sdf/Cylinder.hh
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,10 @@
#ifndef SDF_CYLINDER_HH_
#define SDF_CYLINDER_HH_

#include <optional>

#include <gz/math/Cylinder.hh>
#include <gz/math/Inertial.hh>
#include <gz/utils/ImplPtr.hh>
#include <sdf/Error.hh>
#include <sdf/Element.hh>
Expand Down Expand Up @@ -72,6 +75,12 @@ namespace sdf
/// \return A reference to a gz::math::Cylinderd object.
public: gz::math::Cylinderd &Shape();

/// \brief Calculate and return the Mass Matrix values for the Cylinder
/// \param[in] _density Density of the cylinder in kg/m^3
/// \return A std::optional with gz::math::Inertiald object or std::nullopt
public: std::optional<gz::math::Inertiald>
CalculateInertial(double _density);

/// \brief Create and return an SDF element filled with data from this
/// cylinder.
/// Note that parameter passing functionality is not captured with this
Expand Down
9 changes: 9 additions & 0 deletions include/sdf/Ellipsoid.hh
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@
#ifndef SDF_ELLIPSOID_HH_
#define SDF_ELLIPSOID_HH_

#include <optional>

#include <gz/math/Inertial.hh>
#include <gz/math/Ellipsoid.hh>
#include <gz/utils/ImplPtr.hh>
#include <sdf/Error.hh>
Expand Down Expand Up @@ -64,6 +67,12 @@ namespace sdf
/// \return A reference to a gz::math::Ellipsoidd object.
public: gz::math::Ellipsoidd &Shape();

/// \brief Calculate and return the Mass Matrix values for the Ellipsoid
/// \param[in] _density Density of the ellipsoid in kg/m^3
/// \return A std::optional with gz::math::Inertiald object or std::nullopt
public: std::optional<gz::math::Inertiald>
CalculateInertial(double _density);

/// \brief Create and return an SDF element filled with data from this
/// ellipsoid.
/// Note that parameter passing functionality is not captured with this
Expand Down
15 changes: 15 additions & 0 deletions include/sdf/Geometry.hh
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,15 @@
#define SDF_GEOMETRY_HH_

#include <vector>
#include <optional>

#include <gz/utils/ImplPtr.hh>
#include <gz/math/Inertial.hh>
#include <sdf/Error.hh>
#include <sdf/Element.hh>
#include <sdf/sdf_config.h>
#include <sdf/ParserConfig.hh>
#include <sdf/Types.hh>

namespace sdf
{
Expand Down Expand Up @@ -209,6 +213,17 @@ namespace sdf
/// \param[in] _heightmap The heightmap shape.
public: void SetHeightmapShape(const Heightmap &_heightmap);

/// \brief Calculate and return the Mass Matrix values for the Geometry
/// \param[in] _density The density of the geometry element.
/// \param[in] _config Parser Config
/// \param[out] _errors A vector of Errors object. Each object
/// would contain an error code and an error message.
/// \return A std::optional with gz::math::Inertiald object or std::nullopt
public: std::optional<gz::math::Inertiald> CalculateInertial(
azeey marked this conversation as resolved.
Show resolved Hide resolved
double _density,
const sdf::ParserConfig &_config,
sdf::Errors &_errors);

/// \brief Get a pointer to the SDF element that was used during
/// load.
/// \return SDF element pointer. The value will be nullptr if Load has
Expand Down
25 changes: 25 additions & 0 deletions include/sdf/Link.hh
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@
#include "sdf/Types.hh"
#include "sdf/sdf_config.h"
#include "sdf/system_util.hh"
#include "sdf/ParserConfig.hh"
#include "sdf/Error.hh"

namespace sdf
{
Expand Down Expand Up @@ -326,6 +328,16 @@ namespace sdf
public: Errors ResolveInertial(gz::math::Inertiald &_inertial,
const std::string &_resolveTo = "") const;

/// \brief Calculate & set inertial values(mass, mass matrix
/// & inertial pose) for the link. Inertial values can be provided
/// by the user through the SDF or can be calculated automatically
/// by setting the auto attribute to true.
/// \param[out] _errors A vector of Errors object. Each object
/// would contain an error code and an error message.
/// \param[in] _config Custom parser configuration
public: void CalculateInertials(sdf::Errors &_errors,
const ParserConfig &_config);

/// \brief Get the pose of the link. This is the pose of the link
/// as specified in SDF (<link> <pose> ... </pose></link>).
/// \return The pose of the link.
Expand Down Expand Up @@ -380,6 +392,19 @@ namespace sdf
/// \sa Model::SetEnableWind(bool)
public: void SetEnableWind(bool _enableWind);

/// \brief Check if the inertial values for this link were saved.
/// If true, the inertial values for this link wont be calculated
/// when CalculateInertial() is called. This value is set to true
/// when CalculateInertial() is called with SAVE_CALCULATION
/// configuration.
/// \return True if CalculateInertial() was called with SAVE_CALCULATION
/// configuration, false otherwise.
public: bool AutoInertiaSaved() const;

/// \brief Set the autoInertiaSaved() values
/// \param _autoInertiaSaved True or False
public: void SetAutoInertiaSaved(bool _autoInertiaSaved);

/// \brief Add a collision to the link.
/// \param[in] _collision Collision to add.
/// \return True if successful, false if a collision with the name already
Expand Down
8 changes: 8 additions & 0 deletions include/sdf/Model.hh
Original file line number Diff line number Diff line change
Expand Up @@ -508,6 +508,14 @@ namespace sdf
/// \param[in] _plugin Plugin to add.
public: void AddPlugin(const Plugin &_plugin);

/// \brief Calculate and set the inertials for all the links belonging
/// to the model object
/// \param[out] _errrors A vector of Errors objects. Each errors contains an
/// Error code and a message. An empty errors vector indicates no errors
/// \param[in] _config Custom parser configuration
public: void CalculateInertials(sdf::Errors &_errors,
const ParserConfig &_config);

/// \brief Give the scoped PoseRelativeToGraph to be used for resolving
/// poses. This is private and is intended to be called by Root::Load or
/// World::SetPoseRelativeToGraph if this is a standalone model and
Expand Down
25 changes: 25 additions & 0 deletions include/sdf/ParserConfig.hh
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,20 @@ enum class EnforcementPolicy
LOG,
};

/// \enum ConfigureCalculateInertial
/// \brief Configuration options of how CalculateInertial() function
/// would be used
enum class ConfigureCalculateInertial
{
/// \brief If this value is used, CalculateInertial() won't be
/// called from inside the Root::Load() function
SKIP_CALCULATION_IN_LOAD,

/// \brief If this values is used, CalculateInertial() would be
/// called and the computed inertial values would be saved
SAVE_CALCULATION
};

// Forward declare private data class.
class ParserConfigPrivate;

Expand Down Expand Up @@ -160,6 +174,17 @@ class SDFORMAT_VISIBLE ParserConfig
/// \return The deperacted elements policy enum value
public: EnforcementPolicy DeprecatedElementsPolicy() const;

/// \brief Get the current configuration for the CalculateInertial()
/// function
/// \return Current set value of the ConfigureCalculateInertial enum
public: ConfigureCalculateInertial CalculateInertialConfiguration() const;

/// \brief Set the configuration for the CalculateInertial() function
/// \param[in] _configuration The configuration to set for the
/// CalculateInertial() function
public: void SetCalculateInertialConfiguration(
ConfigureCalculateInertial _configuration);

/// \brief Registers a custom model parser.
/// \param[in] _modelParser Callback as described in
/// sdf/InterfaceElements.hh.
Expand Down
11 changes: 11 additions & 0 deletions include/sdf/Root.hh
Original file line number Diff line number Diff line change
Expand Up @@ -226,6 +226,17 @@ namespace sdf
/// an error code and message. An empty vector indicates no error.
public: Errors UpdateGraphs();

/// \brief Calculate & set the inertial properties (mass, mass matrix
/// and inertial pose) for all the worlds & models that are children
/// of this Root object. This function can be called after calling
/// UpdateGraphs() since it uses frame graphs to resolve inertial pose
azeey marked this conversation as resolved.
Show resolved Hide resolved
/// for links.
/// \param[in] _config Custom parser configuration
/// \return Errors, which is a vector of Error objects.
/// Each Error includes an error code and message. An empty vector
/// indicates no error.
public: Errors CalculateInertials(const ParserConfig &_config);

/// \brief Create and return an SDF element filled with data from this
/// root.
/// Note that parameter passing functionality is not captured with this
Expand Down
9 changes: 9 additions & 0 deletions include/sdf/Sphere.hh
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@
#ifndef SDF_SPHERE_HH_
#define SDF_SPHERE_HH_

#include <optional>

#include <gz/math/Inertial.hh>
#include <gz/math/Sphere.hh>
#include <gz/utils/ImplPtr.hh>

Expand Down Expand Up @@ -65,6 +68,12 @@ namespace sdf
/// not been called.
public: sdf::ElementPtr Element() const;

/// \brief Calculate and return the Mass Matrix values for the Sphere
/// \param[in] _density Density of the sphere in kg/m^3
/// \return A std::optional with gz::math::Inertiald object or std::nullopt
public: std::optional<gz::math::Inertiald>
CalculateInertial(double _density);

/// \brief Create and return an SDF element filled with data from this
/// sphere.
/// Note that parameter passing functionality is not captured with this
Expand Down
8 changes: 8 additions & 0 deletions include/sdf/World.hh
Original file line number Diff line number Diff line change
Expand Up @@ -516,6 +516,14 @@ namespace sdf
/// \param[in] _plugin Plugin to add.
public: void AddPlugin(const Plugin &_plugin);

/// \brief Calculate and set the inertials for all the models in the world
/// object
/// \param[out] _errrors A vector of Errors objects. Each errors contains an
/// Error code and a message. An empty errors vector indicates no errors
/// \param[in] _config Custom parser configuration
public: void CalculateInertials(sdf::Errors &_errors,
const ParserConfig &_config);

/// \brief Give the Scoped PoseRelativeToGraph to be passed on to child
/// entities for resolving poses. This is private and is intended to be
/// called by Root::Load.
Expand Down
8 changes: 8 additions & 0 deletions sdf/1.11/collision.sdf
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,14 @@
<description>Maximum number of contacts allowed between two entities. This value overrides the max_contacts element defined in physics.</description>
</element>

<element name="density" type="double" default="1000.0" required="0">
<description>
Mass Density of the collision geometry.
This is used to determine mass and inertia values during automatic calculation.
Default is the density of water 1000 kg/m^3.
</description>
</element>

<include filename="pose.sdf" required="0"/>

<include filename="geometry.sdf" required="1"/>
Expand Down
15 changes: 15 additions & 0 deletions sdf/1.11/inertial.sdf
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,25 @@
properties, and optionally its fluid added mass.
</description>

<attribute name="auto" type="bool" default="false" required="0">
<description>
Set to true if you want automatic computation for the moments of inertia (ixx, iyy, izz)
and products of inertia(ixy, iyz, ixz). Default value is false.
</description>
</attribute>

<element name="mass" type="double" default="1.0" required="0">
<description>The mass of the link.</description>
</element>

<element name="density" type="double" default="1000.0" required="0">
<description>
Mass Density of the collision geometry.
This is used to determine mass and inertia values during automatic calculation.
azeey marked this conversation as resolved.
Show resolved Hide resolved
Default is the density of water 1000 kg/m^3.
</description>
</element>

<element name="pose" type="pose" default="0 0 0 0 0 0" required="0">
<description>
This pose (translation, rotation) describes the position and orientation
Expand Down
Loading