ISM330DHCX

namespace ISM330DHCX

STMicroelectronics ISM330DHCX sensor.

The STMicroelectronics ISM330DHCX is an iNEMO inertial module with Machine Learning Core, Finite State Machine and digital output for industrial applications.

For technical documents and a complete description of the sensor features please refer to the official documentation at: https://www.st.com/en/mems-and-sensors/ism330dhcx.html

To create a STMicroelectronics ISM330DHCX sensor use the HUX_DECLARE_SENSOR construct:

HUX_DECLARE_SENSOR(sensor_name, hux::sensors::STMicroelectronics::ISM330DHCX);

Simulation data

To define simulation data for a STMicroelectronics ISM330DHCX sensor use the HUX_DECLARE_SIMULATION_DATA construct, making sure that the simulation data match the following data type:

typedef hux::tuple<std::vector<float>, std::vector<float>, std::vector<float>, std::vector<float>, std::vector<float>, std::vector<float>, std::vector<hux::uint64_t>> hux::sensors::STMicroelectronics::ISM330DHCX::simulation_data_t

The type of data required for simulation purposes.

A hux::tuple of std::vector of the following types:

  • float: Acceleration on the X axis in g units

  • float: Acceleration on the Y axis in g units

  • float: Acceleration on the Z axis in g units

  • float: Angular velocity on the X axis in radiants/second

  • float: Angular velocity on the Y axis in radiants/second

  • float: Angular velocity on the Z axis in radiants/second

  • hux::uint64_t: Unix timestamp in milliseconds of the data generated by the sensor

This example shows how to load simulation data for a STMicroelectronics ISM330DHCX sensor from a CSV file whose columns are separated by semicolon (“;”):

HUX_DECLARE_SIMULATION_DATA(sim_data,
    hux::simulation::load_csv<float, float, float, float, float, float, hux::uint64_t>("dataset.csv", ";"))
);

HUX_DECLARE_SENSOR(sensor_name, hux::sensors::STMicroelectronics::ISM330DHCX, sim_data);

Sources

The STMicroelectronics ISM330DHCX sensor offers the following sources:

inline constexpr const auto get_accX()

Acceleration on the X axis in g units.

Returns

The accX axis Source

inline constexpr const auto get_accY()

Acceleration on the Y axis in g units.

Returns

The accY axis Source

inline constexpr const auto get_accZ()

Acceleration on the Z axis in g units.

Returns

The accZ axis Source

inline constexpr const auto get_accV2()

Acceleration squared magnitude.

Returns

The accV2 axis Source

inline constexpr const auto get_accV()

Acceleration magnitude in g units.

Returns

The accV axis Source

inline constexpr const auto get_gyrX()

Angular velocity on the X axis in radiants/second.

Returns

The gyrX axis Source

inline constexpr const auto get_gyrY()

Angular velocity on the Y axis in radiants/second.

Returns

The gyrY axis Source

inline constexpr const auto get_gyrZ()

Angular velocity on the Z axis in radiants/second.

Returns

The gyrZ axis Source

inline constexpr const auto get_gyrV2()

Angular velocity squared magnitude.

Returns

The gyrV2 axis Source

inline constexpr const auto get_gyrV()

Angular velocity magnitude in radiants/second.

Returns

The gyrV axis Source

inline constexpr const auto get_timestamp()

Unix timestamp in milliseconds of the data generated by the sensor.

Returns

The Unix timestamp in milliseconds of the data generated by the sensor

inline constexpr const auto get_mean_accX()

Mean Acceleration on the X axis in g units.

MEAN

Returns

The mean_accX axis Source

inline constexpr const auto get_mean_accY()

Mean Acceleration on the Y axis in g units.

Returns

The mean_accY axis Source

inline constexpr const auto get_mean_accZ()

Mean Acceleration on the Z axis in g units.

Returns

The mean_accZ axis Source

inline constexpr const auto get_mean_accV2()

Mean Acceleration squared magnitude.

Returns

The mean_accV2 axis Source

inline constexpr const auto get_mean_accV()

Mean Acceleration magnitude in g units.

Returns

The mean_accV axis Source

inline constexpr const auto get_mean_gyrX()

Mean Angular velocity on the X axis in radiants/second.

Returns

The mean_gyrX axis Source

inline constexpr const auto get_mean_gyrY()

Mean Angular velocity on the Y axis in radiants/second.

Returns

The mean_gyrY axis Source

inline constexpr const auto get_mean_gyrZ()

Mean Angular velocity on the Z axis in radiants/second.

Returns

The mean_gyrZ axis Source

inline constexpr const auto get_mean_gyrV2()

Mean Angular velocity squared magnitude.

Returns

The mean_gyrV2 axis Source

inline constexpr const auto get_mean_gyrV()

Mean Angular velocity magnitude in radiants/second.

Returns

The mean_gyrV axis Source

inline constexpr const auto get_var_accX()

Variance of Acceleration on the X axis in g units.

VARIANCE

Returns

The var_accX axis Source

inline constexpr const auto get_var_accY()

Variance of Acceleration on the Y axis in g units.

Returns

The var_accY axis Source

inline constexpr const auto get_var_accZ()

Variance of Acceleration on the Z axis in g units.

Returns

The var_accZ axis Source

inline constexpr const auto get_var_accV2()

Variance of Acceleration squared magnitude.

Returns

The var_accV2 axis Source

inline constexpr const auto get_var_accV()

Variance of Acceleration magnitude in g units.

Returns

The var_accV axis Source

inline constexpr const auto get_var_gyrX()

Variance of Angular velocity on the X axis in radiants/second.

Returns

The var_gyrX axis Source

inline constexpr const auto get_var_gyrY()

Variance of Angular velocity on the Y axis in radiants/second.

Returns

The var_gyrY axis Source

inline constexpr const auto get_var_gyrZ()

Variance of Angular velocity on the Z axis in radiants/second.

Returns

The var_gyrZ axis Source

inline constexpr const auto get_var_gyrV2()

Variance of Angular velocity squared magnitude.

Returns

The var_gyrV2 axis Source

inline constexpr const auto get_var_gyrV()

Variance of Angular velocity magnitude in radiants/second.

Returns

The var_gyrV axis Source

inline constexpr const auto get_pp_accX()

Peek-to-peek of Acceleration on the X axis in g units.

PEEK-TO-PEEK

Returns

The pp_accX axis Source

inline constexpr const auto get_pp_accY()

Peek-to-peek of Acceleration on the Y axis in g units.

Returns

The pp_accY axis Source

inline constexpr const auto get_pp_accZ()

Peek-to-peek of Acceleration on the Z axis in g units.

Returns

The pp_accZ axis Source

inline constexpr const auto get_pp_accV2()

Peek-to-peek of Acceleration squared magnitude.

Returns

The pp_accV2 axis Source

inline constexpr const auto get_pp_accV()

Peek-to-peek of Acceleration magnitude in g units.

Returns

The pp_accV axis Source

inline constexpr const auto get_pp_gyrX()

Peek-to-peek of Angular velocity on the X axis in radiants/second.

Returns

The pp_gyrX axis Source

inline constexpr const auto get_pp_gyrY()

Peek-to-peek of Angular velocity on the Y axis in radiants/second.

Returns

The pp_gyrY axis Source

inline constexpr const auto get_pp_gyrZ()

Peek-to-peek of Angular velocity on the Z axis in radiants/second.

Returns

The pp_gyrZ axis Source

inline constexpr const auto get_pp_gyrV2()

Peek-to-peek of Angular velocity squared magnitude.

Returns

The pp_gyrV2 axis Source

inline constexpr const auto get_pp_gyrV()

Peek-to-peek of Angular velocity magnitude in radiants/second.

Returns

The pp_gyrV axis Source

inline constexpr const auto get_min_accX()

Minimum of Acceleration on the X axis in g units.

MIN

Returns

The min_accX axis Source

inline constexpr const auto get_min_accY()

Minimum of Acceleration on the Y axis in g units.

Returns

The min_accY axis Source

inline constexpr const auto get_min_accZ()

Minimum of Acceleration on the Z axis in g units.

Returns

The min_accZ axis Source

inline constexpr const auto get_min_accV2()

Minimum of Acceleration squared magnitude.

Returns

The min_accV2 axis Source

inline constexpr const auto get_min_accV()

Minimum of Acceleration magnitude in g units.

Returns

The min_accV axis Source

inline constexpr const auto get_min_gyrX()

Minimum of Angular velocity on the X axis in radiants/second.

Returns

The min_gyrX axis Source

inline constexpr const auto get_min_gyrY()

Minimum of Angular velocity on the Y axis in radiants/second.

Returns

The min_gyrY axis Source

inline constexpr const auto get_min_gyrZ()

Minimum of Angular velocity on the Z axis in radiants/second.

Returns

The min_gyrZ axis Source

inline constexpr const auto get_min_gyrV2()

Minimum of Angular velocity squared magnitude.

Returns

The min_gyrV2 axis Source

inline constexpr const auto get_min_gyrV()

Minimum of Angular velocity magnitude in radiants/second.

Returns

The min_gyrV axis Source

inline constexpr const auto get_max_accX()

Maximum of Acceleration on the X axis in g units.

MAX

Returns

The max_accX axis Source

inline constexpr const auto get_max_accY()

Maximum of Acceleration on the Y axis in g units.

Returns

The max_accY axis Source

inline constexpr const auto get_max_accZ()

Maximum of Acceleration on the Z axis in g units.

Returns

The max_accZ axis Source

inline constexpr const auto get_max_accV2()

Maximum of Acceleration squared magnitude.

Returns

The max_accV2 axis Source

inline constexpr const auto get_max_accV()

Maximum of Acceleration magnitude in g units.

Returns

The max_accV axis Source

inline constexpr const auto get_max_gyrX()

Maximum of Angular velocity on the X axis in radiants/second.

Returns

The max_gyrX axis Source

inline constexpr const auto get_max_gyrY()

Maximum of Angular velocity on the Y axis in radiants/second.

Returns

The max_gyrY axis Source

inline constexpr const auto get_max_gyrZ()

Maximum of Angular velocity on the Z axis in radiants/second.

Returns

The max_gyrZ axis Source

inline constexpr const auto get_max_gyrV2()

Maximum of Angular velocity squared magnitude.

Returns

The max_gyrV2 axis Source

inline constexpr const auto get_max_gyrV()

Maximum of Angular velocity magnitude in radiants/second.

Returns

The max_gyrV axis Source

Configurations

Initial configuration

To define an initial configuration for a STMicroelectronics ISM330DHCX sensor use the HUX_DECLARE_SENSOR_CONFIGURATION construct:

HUX_DECLARE_SENSOR_CONFIGURATION(conf_name, hux::sensors::STMicroelectronics::ISM330DHCX,
    .PARAM_1 = VALUE_1,
    .PARAM_2 = VALUE_2,
    ...
);

HUX_DECLARE_SENSOR(sensor_name, hux::sensors::STMicroelectronics::ISM330DHCX, {}, conf_name);

where PARAM_1, PARAM_2, … can be any of the following:

float acc_odr = configs::acc_odr_12_5

The sampling frequency for the accelerometer. The actual output data rate of the sensor sources is the maximum between acc_odr and gyr_odr. If acc_odr is lower than gyr_odr, the accelerometer sources will produce repeated data.

float acc_fs = configs::acc_fs_16

Full scale range for the accelerometer

float gyr_odr = configs::gyr_odr_12_5

The sampling frequency for the gyroscope. The actual output data rate of the sensor sources is the maximum between acc_odr and gyr_odr. If gyr_odr is lower than acc_odr, the gyroscope sources will produce repeated data.

float gyr_fs = configs::gyr_fs_2000

Full scale range for the gyroscope

uint32_t ws = 26

The Window Size, i.e. the number of samples over which the following sources are computed: mean, variance, peak-to-peak, min and max

Note

If a parameter is not specified within the sensor configuration its default value is used.

Valid configuration values

Each sensor model has its own configuration values that are permitted by the manufacturer and supported by Huxon. The valid configuration values for the configuration parameters of the STMicroelectronics ISM330DHCX are listed below:

struct configs

Available configuration values for STMicroelectronics ISM330DHCX.

Public Static Attributes

static constexpr float acc_odr_12_5 = 12.5
static constexpr float acc_odr_26 = 26.0
static constexpr float acc_odr_52 = 52.0
static constexpr float acc_odr_104 = 104.0
static constexpr float acc_fs_2 = 2
static constexpr float acc_fs_4 = 4
static constexpr float acc_fs_8 = 8
static constexpr float acc_fs_16 = 16
static constexpr float gyr_odr_12_5 = 12.5
static constexpr float gyr_odr_26 = 26.0
static constexpr float gyr_odr_52 = 52.0
static constexpr float gyr_odr_104 = 104.0
static constexpr float gyr_fs_125 = 125
static constexpr float gyr_fs_250 = 250
static constexpr float gyr_fs_500 = 500
static constexpr float gyr_fs_1000 = 1000
static constexpr float gyr_fs_2000 = 2000

Dynamic configuration

The Huxon language provides the capability to reconfigure sensor parameters dynamically while the application is running. This allow to change the behavior of a sensor in response to specific events.

To dynamically reconfigure a STMicroelectronics ISM330DHCX sensor, it is necessary to create a configurator through the HUX_SENSOR_CONFIGURATOR_BUILDER and register it to the sensor using HUX_REGISTER_SENSOR_CONFIGURATOR:

HUX_DECLARE_SENSOR(sensor_name, hux::sensors::STMicroelectronics::ISM330DHCX);

...

auto configurator = HUX_SENSOR_CONFIGURATOR_BUILDER(hux::sensors::STMicroelectronics::ISM330DHCX)
    .add_PARAM1_cfg_chan(param1_channel)
    .add_PARAM2_cfg_chan(param2_channel)
    ...
    .finalize();

HUX_REGISTER_SENSOR_CONFIGURATOR(sensor_name, configurator);

where param1_channel, param2_channel, … are channels that generate configuration values, while the configurator builder methods: add_PARAM1_cfg_chan, add_PARAM2_cfg_chan, … bind such channels to the parameters they will configure. The configurator builder methods can be any of the following:

template<hux::channels::IsChannelOf<float> channel_t>
inline constexpr const auto add_ACC_ODR_cfg_chan(channel_t channel) const

Configures a channel for the ODR (Output Data Rate) parameter of the accelerometer.

Please refer to the official sensor documentation (https://www.st.com/en/mems-and-sensors/ism330dhcx.html) for details on this parameter

Template Parameters

channel_t – The type of input channel supplying the configuration values for the parameter

Parameters

channel – The input channel supplying the configuration values for the parameter

Returns

The updated builder instance (for further method invocation chaining)

template<hux::channels::IsChannelOf<float> channel_t>
inline constexpr const auto add_ACC_FS_cfg_chan(channel_t channel) const

Configures a channel for the FS (Full Scale) parameter of the accelerometer.

Please refer to the official sensor documentation (https://www.st.com/en/mems-and-sensors/ism330dhcx.html) for details on this parameter

Template Parameters

channel_t – The type of input channel supplying the configuration values for the parameter

Parameters

channel – The input channel supplying the configuration values for the parameter

Returns

The updated builder instance (for further method invocation chaining)

template<hux::channels::IsChannelOf<float> channel_t>
inline constexpr const auto add_GYR_ODR_cfg_chan(channel_t channel) const

Configures a channel for the ODR (Output Data Rate) parameter of the gyroscope.

Please refer to the official sensor documentation (https://www.st.com/en/mems-and-sensors/ism330dhcx.html) for details on this parameter

Template Parameters

channel_t – The type of input channel supplying the configuration values for the parameter

Parameters

channel – The input channel supplying the configuration values for the parameter

Returns

The updated builder instance (for further method invocation chaining)

template<hux::channels::IsChannelOf<float> channel_t>
inline constexpr const auto add_GYR_FS_cfg_chan(channel_t channel) const

Configures a channel for the FS (Full Scale) parameter of the gyroscope.

Please refer to the official sensor documentation (https://www.st.com/en/mems-and-sensors/ism330dhcx.html) for details on this parameter

Template Parameters

channel_t – The type of input channel supplying the configuration values for the parameter

Parameters

channel – The input channel supplying the configuration values for the parameter

Returns

The updated builder instance (for further method invocation chaining)