Skip to content

Class inertialsim::sensors::Parameter

template <typename ValueType>

ClassList > inertialsim > sensors > Parameter

A parameter with value and associated units. More...

  • #include <parameter.h>

Public Functions

Type Name
Parameter AsStandardUnits () const
Return a new parameter in SI units.
Parameter (const type_identity_t< ValueType > & value, const std::string & units="")
Construct from exact value type.
Parameter (const Eigen::ArrayBase< Derived > & array, const std::string & units="")
Construct from Eigen array expression.
Parameter (const Eigen::MatrixBase< Derived > & matrix, const std::string & units="")
Construct from Eigen matrix expression.
Parameter (std::initializer_list< double > init_list, const std::string & units="")
Construct from braced list of values.
Parameter (std::initializer_list< std::initializer_list< double > > init_list, const std::string & units="")
Construct from nested braced lists.
auto PerAxis (const int axes) const
Return a new parameter applied on a per-axis basis.
std::string units () const
Return the units string.
ValueType value () const
Return the parameter value.

Detailed Description

A parameter with value and associated units for sensor specifications.

Parameters are used to set sensor specifications to ensure unit conversions are handled correctly. Parameter attributes are read only so that the value and units cannot be changed independently.

Template parameters:

  • ValueType The type of the parameter value. Must be double, SpecificationArray, or Matrix.

Constructors

The Parameter class provides multiple constructors for different value types:

  • Scalar (ValueType = double): Constructs from a scalar value or any arithmetic type (int, float, etc.), which will be converted to double.
  • Array (ValueType = SpecificationArray): Constructs from an Eigen array, an initializer list {val1, val2, ...}, or any Eigen::ArrayBase-derived type.
  • Matrix (ValueType = Matrix): Constructs from an Eigen matrix, a nested initializer list {{val00, val01}, {val10, val11}}, or any Eigen::MatrixBase-derived type.

All constructors accept a units parameter.

Public Functions Documentation

function AsStandardUnits

Return a new parameter in SI units.

Parameter inertialsim::sensors::Parameter::AsStandardUnits () const

Returns a new Parameter object with the value and units fields converted to SI units.

Warning

This function only supports common inertial sensor units. It does not support conversion of arbitrary units. The numerator of the units string can include any of "deg" for degrees, "%" for percent, "ppm" for parts-per-million, "ft" for feet, "gauss" for magnetic field, or "g" for units of standard gravity. The denominator(s) can include any of "/h" for per hour, "/sqrt(h)" for per square-root hour, "/s/sqrt(Hz)" for per second per square root Hertz, and "/F" for per degree Fahrenheit.

Returns:

New Parameter instance with the same ValueType but all values and units converted to SI. The original is unchanged.


function Parameter [1/5]

Construct from exact value type.

inline explicit inertialsim::sensors::Parameter::Parameter (
    const  type_identity_t < ValueType > & value,
    const std::string & units=""
) 

Explicit constructor accepting the exact value type stored by this Parameter.

Parameters:

  • value The parameter value.
  • units The units of the value (e.g., "rad/s", "m/s/s"). Default is empty.

function Parameter [2/5]

Construct from Eigen array expression.

template<typename  Derived, typename>
inline explicit inertialsim::sensors::Parameter::Parameter (
    const Eigen::ArrayBase< Derived > & array,
    const std::string & units=""
) 

Constructs a Parameter from any Eigen::ArrayBase-derived type. The array is converted to double precision.

Template parameters:

  • Derived An Eigen array type derived from Eigen::ArrayBase.

Parameters:

  • array The array value.
  • units The units of the value. Default is empty.

function Parameter [3/5]

Construct from Eigen matrix expression.

template<typename  Derived, typename>
inline explicit inertialsim::sensors::Parameter::Parameter (
    const Eigen::MatrixBase< Derived > & matrix,
    const std::string & units=""
) 

Constructs a Parameter from any Eigen::MatrixBase-derived type. The matrix is converted to double precision.

Template parameters:

  • Derived An Eigen matrix type derived from Eigen::MatrixBase.

Parameters:

  • matrix The matrix value.
  • units The units of the value. Default is empty.

function Parameter [4/5]

Construct from braced list of values.

template<typename  T, typename>
inline inertialsim::sensors::Parameter::Parameter (
    std::initializer_list< double > init_list,
    const std::string & units=""
) 

Constructs a Parameter from an initializer list of values, converting it to a SpecificationArray.

Parameters:

  • init_list List of values.
  • units The units of the value. Default is empty.

function Parameter [5/5]

Construct from nested braced lists.

template<typename  T, typename>
inline inertialsim::sensors::Parameter::Parameter (
    std::initializer_list< std::initializer_list< double > > init_list,
    const std::string & units=""
) 

Constructs a Parameter from a nested initializer list, converting it to a Matrix with row-wise ordering.

Parameters:

  • init_list Nested list of values (rows and columns).
  • units The units of the value. Default is empty.

function PerAxis

Return a new parameter applied on a per-axis basis.

inline auto inertialsim::sensors::Parameter::PerAxis (
    const  int axes
) const

If the parameter is a scalar (ValueType = double), returns a new Parameter with the value replicated across the requested number of axes as a SpecificationArray. If the parameter is already an array with the correct size, validates and returns a copy. Matrices cannot be broadcast.

Parameters:

  • axes Number of axes.

Returns:

New Parameter<SpecificationArray> instance with the value applied per-axis. The original is unchanged.

Exception:

  • std::runtime_error If the parameter is an array with size not matching the requested number of axes, or if ValueType is Matrix.

function units

Return the units string.

inline std::string inertialsim::sensors::Parameter::units () const

Returns:

The units of measurement of the associated value (e.g., "rad/s").


function value

Return the parameter value.

inline ValueType inertialsim::sensors::Parameter::value () const

Returns:

The parameter value (numeric value or array of values).



The documentation for this class was generated from the following file cpp/include/inertialsim/sensors/parameter.h