Public Member Functions | List of all members
sdf::SDF_VERSION_NAMESPACE::Imu Class Reference

Imu contains information about an imu sensor. More...

#include <Imu.hh>

Public Member Functions

 Imu ()
 Default constructor. More...
 
const NoiseAngularVelocityXNoise () const
 Get the noise values related to the body-frame angular velocity on the X-axis. More...
 
const NoiseAngularVelocityYNoise () const
 Get the noise values related to the body-frame angular velocity around the Y-axis. More...
 
const NoiseAngularVelocityZNoise () const
 Get the noise values related to the body-frame angular velocity around the Z-axis. More...
 
const gz::math::Vector3d & CustomRpy () const
 This field and CustomRpyParentFrame are used when Localization is set to CUSTOM. More...
 
const std::string & CustomRpyParentFrame () const
 Get the name of parent frame which the custom_rpy transform is defined relative to. More...
 
sdf::ElementPtr Element () const
 Get a pointer to the SDF element that was used during load. More...
 
const gz::math::Vector3d & GravityDirX () const
 Used when localization is set to GRAV_UP or GRAV_DOWN, a projection of this vector into a plane that is orthogonal to the gravity vector defines the direction of the IMU reference frame's X-axis. More...
 
const std::string & GravityDirXParentFrame () const
 Get the name of parent frame which the GravityDirX vector is defined relative to. More...
 
const NoiseLinearAccelerationXNoise () const
 Get the noise values related to the body-frame linear acceleration on the X-axis. More...
 
const NoiseLinearAccelerationYNoise () const
 Get the noise values related to the body-frame linear acceleration on the Y-axis. More...
 
const NoiseLinearAccelerationZNoise () const
 Get the noise values related to the body-frame linear acceleration on the Z-axis. More...
 
Errors Load (ElementPtr _sdf)
 Load the IMU based on an element pointer. More...
 
const std::string & Localization () const
 This string represents special hardcoded use cases that are commonly seen with typical robot IMU's: More...
 
bool operator!= (const Imu &_imu) const
 Return true this Imu object does not contain the same values as the passed in parameter. More...
 
bool operator== (const Imu &_imu) const
 Return true if both Imu objects contain the same values. More...
 
bool OrientationEnabled () const
 Get whether orientation data generation is enabled. More...
 
void SetAngularVelocityXNoise (const Noise &_noise)
 Set the noise values related to the body-frame angular velocity around the X-axis. More...
 
void SetAngularVelocityYNoise (const Noise &_noise)
 Set the noise values related to the body-frame angular velocity around the Y-axis. More...
 
void SetAngularVelocityZNoise (const Noise &_noise)
 Set the noise values related to the body-frame angular velocity around the Z-axis. More...
 
void SetCustomRpy (const gz::math::Vector3d &_rpy)
 See CustomRpy() const. More...
 
void SetCustomRpyParentFrame (const std::string &_frame)
 Set the name of parent frame which the custom_rpy transform is defined relative to. More...
 
void SetGravityDirX (const gz::math::Vector3d &_grav)
 Used when localization is set to GRAV_UP or GRAV_DOWN, a projection of this vector into a plane that is orthogonal to the gravity vector defines the direction of the IMU reference frame's X-axis. More...
 
void SetGravityDirXParentFrame (const std::string &_frame)
 Set the name of parent frame which the GravityDirX vector is defined relative to. More...
 
void SetLinearAccelerationXNoise (const Noise &_noise)
 Set the noise values related to the body-frame linear acceleration on the X-axis. More...
 
void SetLinearAccelerationYNoise (const Noise &_noise)
 Set the noise values related to the body-frame linear acceleration on the Y-axis. More...
 
void SetLinearAccelerationZNoise (const Noise &_noise)
 Set the noise values related to the body-frame linear acceleration on the Z-axis. More...
 
void SetLocalization (const std::string &_localization)
 See Localization(const std::string &). More...
 
void SetOrientationEnabled (bool _enabled)
 Set whether to enable orientation data generation. More...
 
sdf::ElementPtr ToElement () const
 Create and return an SDF element filled with data from this imu sensor. More...
 
sdf::ElementPtr ToElement (sdf::Errors &_errors) const
 Create and return an SDF element filled with data from this imu sensor. More...
 

Detailed Description

Imu contains information about an imu sensor.

This sensor can be attached to a link.

Constructor & Destructor Documentation

◆ Imu()

sdf::SDF_VERSION_NAMESPACE::Imu::Imu ( )

Default constructor.

Member Function Documentation

◆ AngularVelocityXNoise()

const Noise& sdf::SDF_VERSION_NAMESPACE::Imu::AngularVelocityXNoise ( ) const

Get the noise values related to the body-frame angular velocity on the X-axis.

Returns
Noise values for the X-axis linear acceleration.

◆ AngularVelocityYNoise()

const Noise& sdf::SDF_VERSION_NAMESPACE::Imu::AngularVelocityYNoise ( ) const

Get the noise values related to the body-frame angular velocity around the Y-axis.

Returns
Noise values for the Y-axis angular velocity.

◆ AngularVelocityZNoise()

const Noise& sdf::SDF_VERSION_NAMESPACE::Imu::AngularVelocityZNoise ( ) const

Get the noise values related to the body-frame angular velocity around the Z-axis.

Returns
Noise values for the Z-axis angular velocity.

◆ CustomRpy()

const gz::math::Vector3d& sdf::SDF_VERSION_NAMESPACE::Imu::CustomRpy ( ) const

This field and CustomRpyParentFrame are used when Localization is set to CUSTOM.

Orientation (fixed axis roll, pitch yaw) transform from ParentFrame to this IMU's reference frame.

Some common examples are:

  • IMU reports in its local frame on boot. IMU sensor frame is the reference frame. Example: parent_frame="", custom_rpy="0 0 0"
  • IMU reports in Gazebo world frame. Example sdf: parent_frame="world", custom_rpy="0 0 0"
  • IMU reports in NWU frame. Uses SphericalCoordinates class to determine world frame in relation to magnetic north and gravity; i.e. rotation between North-West-Up and world (+X,+Y,+Z) frame is defined by SphericalCoordinates class. Example sdf given world is NWU: parent_frame="world", custom_rpy="0 0 0"
  • IMU reports in NED frame. Uses SphericalCoordinates class to determine world frame in relation to magnetic north and gravity; i.e. rotation between North-East-Down and world (+X,+Y,+Z) frame is defined by SphericalCoordinates class. Example sdf given world is NWU: parent_frame="world", custom_rpy="M_PI 0 0"
  • IMU reports in ENU frame. Uses SphericalCoordinates class to determine world frame in relation to magnetic north and gravity; i.e. rotation between East-North-Up and world (+X,+Y,+Z) frame is defined by SphericalCoordinates class. Example sdf given world is NWU: parent_frame="world", custom_rpy="0 0 -0.5*M_PI"
  • IMU reports in ROS optical frame as described in http://www.ros.org/reps/rep-0103.html#suffix-frames, which is (z-forward, x-left to right when facing +z, y-top to bottom when facing +z). (default gazebo camera is +x:view direction, +y:left, +z:up). Example sdf: parent_frame="local", custom_rpy="-0.5*M_PI 0 -0.5*M_PI"
    Returns
    Custom RPY vectory

◆ CustomRpyParentFrame()

const std::string& sdf::SDF_VERSION_NAMESPACE::Imu::CustomRpyParentFrame ( ) const

Get the name of parent frame which the custom_rpy transform is defined relative to.

It can be any valid fully scoped link name or the special reserved "world" frame. If left empty, use the sensor's own local frame.

Returns
The name of the parent frame.

◆ Element()

sdf::ElementPtr sdf::SDF_VERSION_NAMESPACE::Imu::Element ( ) const

Get a pointer to the SDF element that was used during load.

Returns
SDF element pointer. The value will be nullptr if Load has not been called.

◆ GravityDirX()

const gz::math::Vector3d& sdf::SDF_VERSION_NAMESPACE::Imu::GravityDirX ( ) const

Used when localization is set to GRAV_UP or GRAV_DOWN, a projection of this vector into a plane that is orthogonal to the gravity vector defines the direction of the IMU reference frame's X-axis.

grav_dir_x is defined in the coordinate frame as defined by the parent_frame element.

Returns
The gravity direction.

◆ GravityDirXParentFrame()

const std::string& sdf::SDF_VERSION_NAMESPACE::Imu::GravityDirXParentFrame ( ) const

Get the name of parent frame which the GravityDirX vector is defined relative to.

It can be any valid fully scoped link name or the special reserved "world" frame. If left empty, use the sensor's own local frame.

Returns
The name of the parent frame.

◆ LinearAccelerationXNoise()

const Noise& sdf::SDF_VERSION_NAMESPACE::Imu::LinearAccelerationXNoise ( ) const

Get the noise values related to the body-frame linear acceleration on the X-axis.

Returns
Noise values for the X-axis linear acceleration.

◆ LinearAccelerationYNoise()

const Noise& sdf::SDF_VERSION_NAMESPACE::Imu::LinearAccelerationYNoise ( ) const

Get the noise values related to the body-frame linear acceleration on the Y-axis.

Returns
Noise values for the Y-axis linear acceleration.

◆ LinearAccelerationZNoise()

const Noise& sdf::SDF_VERSION_NAMESPACE::Imu::LinearAccelerationZNoise ( ) const

Get the noise values related to the body-frame linear acceleration on the Z-axis.

Returns
Noise values for the Z-axis linear acceleration.

◆ Load()

Errors sdf::SDF_VERSION_NAMESPACE::Imu::Load ( ElementPtr  _sdf)

Load the IMU based on an element pointer.

This is not the usual entry point. Typical usage of the SDF DOM is through the Root object.

Parameters
[in]_sdfThe SDF Element pointer
Returns
Errors, which is a vector of Error objects. Each Error includes an error code and message. An empty vector indicates no error.

◆ Localization()

const std::string& sdf::SDF_VERSION_NAMESPACE::Imu::Localization ( ) const

This string represents special hardcoded use cases that are commonly seen with typical robot IMU's:

  • CUSTOM: use Euler angle custom_rpy orientation specification. The orientation of the IMU's reference frame is defined by adding the custom_rpy rotation to the parent_frame.
  • NED: The IMU XYZ aligns with NED, where NED orientation relative to the world is defined by the SphericalCoordinates class.
  • ENU: The IMU XYZ aligns with ENU, where ENU orientation relative to the world is defined by the SphericalCoordinates class.
  • NWU: The IMU XYZ aligns with NWU, where NWU orientation relative to the world is defined by the SphericalCoordinates class.
  • GRAV_UP: where direction of gravity maps to IMU reference frame Z-axis with Z-axis pointing in the opposite direction of gravity. IMU reference frame X-axis direction is defined by GravityDirX(). Note if GravityDirX() is parallel to gravity direction, this configuration fails. Otherwise, IMU reference frame X-axis is defined by projection of GravtyDirX onto a plane normal to the gravity vector. IMU reference frame Y-axis is a vector orthogonal to both X and Z axis following the right hand rule.

GRAV_DOWN: where direction of gravity maps to IMU reference frame Z-axis with Z-axis pointing in the direction of gravity. IMU reference frame X-axis direction is defined by GravityDirX(). Note if GravityDirX() is parallel to gravity direction, this configuration fails. Otherwise, IMU reference frame X-axis is defined by projection of GravityDirX() onto a plane normal to the gravity vector. IMU reference frame Y-axis is a vector orthogonal to both X and Z axis following the right hand rule.

Returns
Localization frame name

◆ operator!=()

bool sdf::SDF_VERSION_NAMESPACE::Imu::operator!= ( const Imu _imu) const

Return true this Imu object does not contain the same values as the passed in parameter.

Parameters
[_in]_imu Imu value to compare. \returen True if 'this' != _imu.

◆ operator==()

bool sdf::SDF_VERSION_NAMESPACE::Imu::operator== ( const Imu _imu) const

Return true if both Imu objects contain the same values.

Parameters
[_in]_imu Imu value to compare. \returen True if 'this' == _imu.

◆ OrientationEnabled()

bool sdf::SDF_VERSION_NAMESPACE::Imu::OrientationEnabled ( ) const

Get whether orientation data generation is enabled.

Returns
True if orientation data generation is enabled orientation data, false otherwise.

◆ SetAngularVelocityXNoise()

void sdf::SDF_VERSION_NAMESPACE::Imu::SetAngularVelocityXNoise ( const Noise _noise)

Set the noise values related to the body-frame angular velocity around the X-axis.

Parameters
[in]_noiseNoise values for the X-axis angular velocity.

◆ SetAngularVelocityYNoise()

void sdf::SDF_VERSION_NAMESPACE::Imu::SetAngularVelocityYNoise ( const Noise _noise)

Set the noise values related to the body-frame angular velocity around the Y-axis.

Parameters
[in]_noiseNoise values for the Y-axis angular velocity.

◆ SetAngularVelocityZNoise()

void sdf::SDF_VERSION_NAMESPACE::Imu::SetAngularVelocityZNoise ( const Noise _noise)

Set the noise values related to the body-frame angular velocity around the Z-axis.

Parameters
[in]_noiseNoise values for the Z-axis angular velocity.

◆ SetCustomRpy()

void sdf::SDF_VERSION_NAMESPACE::Imu::SetCustomRpy ( const gz::math::Vector3d &  _rpy)

See CustomRpy() const.

Parameters
[in]CustomRPY vectory

◆ SetCustomRpyParentFrame()

void sdf::SDF_VERSION_NAMESPACE::Imu::SetCustomRpyParentFrame ( const std::string &  _frame)

Set the name of parent frame which the custom_rpy transform is defined relative to.

It can be any valid fully scoped link name or the special reserved "world" frame. If left empty, use the sensor's own local frame.

Parameters
[in]_frameThe name of the parent frame.

◆ SetGravityDirX()

void sdf::SDF_VERSION_NAMESPACE::Imu::SetGravityDirX ( const gz::math::Vector3d &  _grav)

Used when localization is set to GRAV_UP or GRAV_DOWN, a projection of this vector into a plane that is orthogonal to the gravity vector defines the direction of the IMU reference frame's X-axis.

grav_dir_x is defined in the coordinate frame as defined by the parent_frame element.

Parameters
[in]_gravThe gravity direction.

◆ SetGravityDirXParentFrame()

void sdf::SDF_VERSION_NAMESPACE::Imu::SetGravityDirXParentFrame ( const std::string &  _frame)

Set the name of parent frame which the GravityDirX vector is defined relative to.

It can be any valid fully scoped link name or the special reserved "world" frame. If left empty, use the sensor's own local frame.

Returns
The name of the parent frame.

◆ SetLinearAccelerationXNoise()

void sdf::SDF_VERSION_NAMESPACE::Imu::SetLinearAccelerationXNoise ( const Noise _noise)

Set the noise values related to the body-frame linear acceleration on the X-axis.

Parameters
[in]_noiseNoise values for the X-axis linear acceleration.

◆ SetLinearAccelerationYNoise()

void sdf::SDF_VERSION_NAMESPACE::Imu::SetLinearAccelerationYNoise ( const Noise _noise)

Set the noise values related to the body-frame linear acceleration on the Y-axis.

Parameters
[in]_noiseNoise values for the Y-axis linear acceleration.

◆ SetLinearAccelerationZNoise()

void sdf::SDF_VERSION_NAMESPACE::Imu::SetLinearAccelerationZNoise ( const Noise _noise)

Set the noise values related to the body-frame linear acceleration on the Z-axis.

Parameters
[in]_noiseNoise values for the Z-axis linear acceleration.

◆ SetLocalization()

void sdf::SDF_VERSION_NAMESPACE::Imu::SetLocalization ( const std::string &  _localization)

See Localization(const std::string &).

Parameters
[in]_localizationLocalization frame name

◆ SetOrientationEnabled()

void sdf::SDF_VERSION_NAMESPACE::Imu::SetOrientationEnabled ( bool  _enabled)

Set whether to enable orientation data generation.

Parameters
[in]_enabledTrue to enabled orientation data, false to disable it.

◆ ToElement() [1/2]

sdf::ElementPtr sdf::SDF_VERSION_NAMESPACE::Imu::ToElement ( ) const

Create and return an SDF element filled with data from this imu sensor.

Note that parameter passing functionality is not captured with this function.

Returns
SDF element pointer with updated sensor values.

◆ ToElement() [2/2]

sdf::ElementPtr sdf::SDF_VERSION_NAMESPACE::Imu::ToElement ( sdf::Errors _errors) const

Create and return an SDF element filled with data from this imu sensor.

Note that parameter passing functionality is not captured with this function.

Parameters
[out]_errorsVector of errors.
Returns
SDF element pointer with updated sensor values.

The documentation for this class was generated from the following file: