C / C++ API Reference
IMU.IMU()
IMU::IMU(uint32_t device_id, Interface *interface)
Description
Construct a new IMU object.
Parameters
| Datatype | Variable | Description |
|---|
uint32_t | device_id | Device ID for the IMU device |
Interface* | interface | CAN Interface object connected to the IMU |
IMU.getNodeId()
ret_status_t IMU::getNodeId(uint32_t *node_id)
Description
Get current CAN Node ID of NIMU.
Parameters
| Datatype | Variable | Description |
|---|
uint32_t * | node_id | Pointer to the variable to which the current CAN Node ID of the NIMU is to be saved. |
Returns
| Datatype | Description |
|---|
ret_status_t | Return Status |
IMU.setNodeId()
ret_status_t IMU::setNodeId(uint32_t id)
Description
Set the node id for the IMU.
Parameters
| Datatype | Variable | Description |
|---|
uint32_t | id | CAN Node ID of the IMU |
Returns
| Datatype | Description |
|---|
ret_status_t | Return Status |
IMU.enableRotationVector()
ret_status_t IMU::enableRotationVector(uint16_t report_interval)
Description
Enable rotation vector data and configure it.
Parameters
| Datatype | Variable | Description |
|---|
uint16_t | report_interval | Report interval in milliseconds |
Returns
| Datatype | Description |
|---|
ret_status_t | Return Status |
IMU.disableRotationVector()
ret_status_t IMU::disableRotationVector()
Description
Disable rotation vector data.
Returns
| Datatype | Description |
|---|
ret_status_t | Return Status |
IMU.enableRawAccelerometer()
ret_status_t IMU::enableRawAccelerometer(uint16_t report_interval)
Description
Enable raw accelerometer data and configure it.
Parameters
| Datatype | Variable | Description |
|---|
uint16_t | report_interval | Report interval in milliseconds |
Returns
| Datatype | Description |
|---|
ret_status_t | Return Status |
IMU.disableRawAccelerometer()
ret_status_t IMU::disableRawAccelerometer()
Description
Disable raw accelerometer data.
Returns
| Datatype | Description |
|---|
ret_status_t | Return Status |
IMU.enableRawGyro()
ret_status_t IMU::enableRawGyro(uint16_t report_interval)
Description
Enable raw gyroscope data and configure it.
Parameters
| Datatype | Variable | Description |
|---|
uint16_t | report_interval | Report interval in milliseconds |
Returns
| Datatype | Description |
|---|
ret_status_t | Return Status |
IMU.disableRawGyro()
ret_status_t IMU::disableRawGyro()
Description
Disable raw gyroscope data.
Returns
| Datatype | Description |
|---|
ret_status_t | Return Status |
IMU.enableRawMagnetometer()
ret_status_t IMU::enableRawMagnetometer(uint16_t report_interval)
Description
Enable raw magnetometer data and configure it.
Parameters
| Datatype | Variable | Description |
|---|
uint16_t | report_interval | Report interval in milliseconds |
Returns
| Datatype | Description |
|---|
ret_status_t | Return Status |
IMU.disableRawMagnetometer()
ret_status_t IMU::disableRawMagnetometer()
Description
Disable raw magnetometer data.
Returns
| Datatype | Description |
|---|
ret_status_t | Return Status |
IMU.enableLinearAccelerometer()
ret_status_t IMU::enableLinearAccelerometer(uint16_t report_interval)
Description
Enable linear accelerometer data and configure it.
Parameters
| Datatype | Variable | Description |
|---|
uint16_t | report_interval | Report interval in milliseconds |
Returns
| Datatype | Description |
|---|
ret_status_t | Return Status |
IMU.disableLinearAccelerometer()
ret_status_t IMU::disableLinearAccelerometer()
Description
Disable linear accelerometer data.
Returns
| Datatype | Description |
|---|
ret_status_t | Return Status |
IMU.enableAccelerometer()
ret_status_t IMU::enableAccelerometer(uint16_t report_interval)
Description
Enable accelerometer data and configure it.
Parameters
| Datatype | Variable | Description |
|---|
uint16_t | report_interval | Report interval in milliseconds |
Returns
| Datatype | Description |
|---|
ret_status_t | Return Status |
IMU.disableAccelerometer()
ret_status_t IMU::disableAccelerometer()
Description
Disable accelerometer data.
Returns
| Datatype | Description |
|---|
ret_status_t | Return Status |
IMU.enableGyro()
ret_status_t IMU::enableGyro(uint16_t report_interval)
Description
Enable gyroscope data and configure it.
Parameters
| Datatype | Variable | Description |
|---|
uint16_t | report_interval | Report interval in milliseconds |
Returns
| Datatype | Description |
|---|
ret_status_t | Return Status |
IMU.disableGyro()
ret_status_t IMU::disableGyro()
Description
Disable gyroscope data.
Returns
| Datatype | Description |
|---|
ret_status_t | Return Status |
IMU.enableMagnetometer()
ret_status_t IMU::enableMagnetometer(uint16_t report_interval)
Description
Enable magnetometer data and configure it.
Parameters
| Datatype | Variable | Description |
|---|
uint16_t | report_interval | Report interval in milliseconds |
Returns
| Datatype | Description |
|---|
ret_status_t | Return Status |
IMU.disableMagnetometer()
ret_status_t IMU::disableMagnetometer()
Description
Disable magnetometer data.
Returns
| Datatype | Description |
|---|
ret_status_t | Return Status |
IMU.enableUncalibratedGyro()
ret_status_t IMU::enableUncalibratedGyro(uint16_t report_interval)
Description
Enable uncalibrated gyroscope data and configure it.
Parameters
| Datatype | Variable | Description |
|---|
uint16_t | report_interval | Report interval in milliseconds |
Returns
| Datatype | Description |
|---|
ret_status_t | Return Status |
IMU.disableUncalibratedGyro()
ret_status_t IMU::disableUncalibratedGyro()
Description
Disable uncalibrated gyroscope data.
Returns
| Datatype | Description |
|---|
ret_status_t | Return Status |
IMU.enableGravity()
ret_status_t IMU::enableGravity(uint16_t report_interval)
Description
Enable gravity data and configure it.
Parameters
| Datatype | Variable | Description |
|---|
uint16_t | report_interval | Report interval in milliseconds |
Returns
| Datatype | Description |
|---|
ret_status_t | Return Status |
IMU.disableGravity()
ret_status_t IMU::disableGravity()
Description
Disable gravity data.
Returns
| Datatype | Description |
|---|
ret_status_t | Return Status |
IMU.getRotationVectorData()
ret_status_t IMU::getRotationVectorData(float* quat_i, float* quat_j, float* quat_k, float* quat_real)
Description
Retrieves the rotation vector data from the IMU.
Parameters
| Datatype | Variable | Description |
|---|
float* | quat_i | i component of the quaternion |
float* | quat_j | j component of the quaternion |
float* | quat_k | k component of the quaternion |
float* | quat_real | real component of the quaternion |
Returns
| Datatype | Description |
|---|
ret_status_t | Return Status |
IMU.getRawAccelerometerData()
ret_status_t IMU::getRawAccelerometerData(int16_t* x, int16_t* y, int16_t* z)
Description
Retrieves the raw accelerometer data from the IMU.
Parameters
| Datatype | Variable | Description |
|---|
int16_t* | x | raw accelerometer value in x axis |
int16_t* | y | raw accelerometer value in y axis |
int16_t* | z | raw accelerometer value in z axis |
Returns
| Datatype | Description |
|---|
ret_status_t | Return Status |
IMU.getRawGyroData()
ret_status_t IMU::getRawGyroData(int16_t* x, int16_t* y, int16_t* z)
Description
Retrieves the raw gyroscope data from the IMU.
Parameters
| Datatype | Variable | Description |
|---|
int16_t* | x | raw gyro value in x axis |
int16_t* | y | raw gyro value in y axis |
int16_t* | z | raw gyro value in z axis |
Returns
| Datatype | Description |
|---|
ret_status_t | Return Status |
IMU.getRawMagnetometerData()
ret_status_t IMU::getRawMagnetometerData(int16_t* x, int16_t* y, int16_t* z)
Description
Retrieves the raw magnetometer data from the IMU.
Parameters
| Datatype | Variable | Description |
|---|
int16_t* | x | raw magnetometer value in x axis |
int16_t* | y | raw magnetometer value in y axis |
int16_t* | z | raw magnetometer value in z axis |
Returns
| Datatype | Description |
|---|
ret_status_t | Return Status |
IMU.getLinearAccelerometerData()
ret_status_t IMU::getLinearAccelerometerData(float* x, float* y, float* z, uint8_t* accuracy)
Description
Retrieves the linear accelerometer data from the IMU.
Parameters
| Datatype | Variable | Description |
|---|
float* | x | linear acceleration in x axis (m/s²) |
float* | y | linear acceleration in y axis (m/s²) |
float* | z | linear acceleration in z axis (m/s²) |
uint8_t* | accuracy | accuracy of the linear acceleration data |
Returns
| Datatype | Description |
|---|
ret_status_t | Return Status |
IMU.getAccelerometerData()
ret_status_t IMU::getAccelerometerData(float* x, float* y, float* z, uint8_t* accuracy)
Description
Retrieves the accelerometer data from the IMU.
Parameters
| Datatype | Variable | Description |
|---|
float* | x | acceleration in x axis (m/s²) |
float* | y | acceleration in y axis (m/s²) |
float* | z | acceleration in z axis (m/s²) |
uint8_t* | accuracy | accuracy of the acceleration data |
Returns
| Datatype | Description |
|---|
ret_status_t | Return Status |
IMU.getGyroData()
ret_status_t IMU::getGyroData(float* x, float* y, float* z, uint8_t* accuracy)
Description
Retrieves the gyroscope data from the IMU.
Parameters
| Datatype | Variable | Description |
|---|
float* | x | gyro value in x axis (radians per second) |
float* | y | gyro value in y axis (radians per second) |
float* | z | gyro value in z axis (radians per second) |
uint8_t* | accuracy | accuracy of the gyro data |
Returns
| Datatype | Description |
|---|
ret_status_t | Return Status |
IMU.getMagnetometerData()
ret_status_t IMU::getMagnetometerData(float* x, float* y, float* z, uint8_t* accuracy)
Description
Retrieves the magnetometer data from the IMU.
Parameters
| Datatype | Variable | Description |
|---|
float* | x | magnetometer value in x axis (uTesla) |
float* | y | magnetometer value in y axis (uTesla) |
float* | z | magnetometer value in z axis (uTesla) |
uint8_t* | accuracy | accuracy of the magnetometer data |
Returns
| Datatype | Description |
|---|
ret_status_t | Return Status |
IMU.getUncalibratedGyroData()
ret_status_t IMU::getUncalibratedGyroData(float* x, float* y, float* z)
Description
Retrieves the uncalibrated gyroscope data from the IMU.
Parameters
| Datatype | Variable | Description |
|---|
float* | x | uncalibrated gyro value in x axis (radians per second) |
float* | y | uncalibrated gyro value in y axis (radians per second) |
float* | z | uncalibrated gyro value in z axis (radians per second) |
Returns
| Datatype | Description |
|---|
ret_status_t | Return Status |
IMU.getUncalibratedGyroBiasData()
ret_status_t IMU::getUncalibratedGyroBiasData(float* x, float* y, float* z)
Description
Retrieves the uncalibrated gyroscope bias data from the IMU.
Parameters
| Datatype | Variable | Description |
|---|
float* | x | uncalibrated gyro bias in x axis (radians per second) |
float* | y | uncalibrated gyro bias in y axis (radians per second) |
float* | z | uncalibrated gyro bias in z axis (radians per second) |
Returns
| Datatype | Description |
|---|
ret_status_t | Return Status |
IMU.getEulerAngles()
ret_status_t IMU::getEulerAngles(float* yaw, float* pitch, float* roll)
Description
Retrieves the Euler angles from the IMU.
Parameters
| Datatype | Variable | Description |
|---|
float* | yaw | yaw angle (degrees) |
float* | pitch | pitch angle (degrees) |
float* | roll | roll angle (degrees) |
Returns
| Datatype | Description |
|---|
ret_status_t | Return Status |
IMU.getGravityData()
ret_status_t IMU::getGravityData(float* x, float* y, float* z)
Description
Retrieves the gravity data from the IMU.
Parameters
| Datatype | Variable | Description |
|---|
float* | x | gravity in x axis (g) |
float* | y | gravity in y axis (g) |
float* | z | gravity in z axis (g) |
Returns
| Datatype | Description |
|---|
ret_status_t | Return Status |
IMU.isConnected()
Description
Check if the device is still connected.
Returns
| Datatype | Description |
|---|
bool | true if connected, false otherwise |
Python API Reference
IMU.__init__()
__init__(id: int, interface: USBInterface)
Description
IMU class constructor.
Parameters
| Datatype | Variable | Description |
|---|
int | id | CAN Node ID of IMU |
USBInterface | interface | Initialised CANInterface or USBInterface object |
IMU.getNodeId()
getNodeId() -> 'tuple[int, int]'
Description
Get current CAN Node ID of the IMU.
Returns
| Datatype | Description |
|---|
'tuple[int,int]' | Tuple containing return status and the current CAN Node ID. |
IMU.setNodeId()
setNodeId(id: int) -> int
Description
Set the node id for the IMU.
Parameters
| Datatype | Variable | Description |
|---|
int | id | CAN Device ID of the IMU |
Returns
| Datatype | Description |
|---|
int | Return Status |
IMU.getRotationVectorData
getRotationVectorData() -> 'tuple[float, float, float, float]'
Description
Retrieve the rotation vector data from the IMU.
Returns
| Datatype | Description |
|---|
'tuple[float, float, float, float]' | Tuple containing quaternion components (quat_i, quat_j, quat_k, quat_real). |
IMU.getRawAccelerometerData
getRawAccelerometerData() -> 'tuple[int16_t, int16_t, int16_t]'
Description
Retrieve the raw accelerometer data from the IMU.
Returns
| Datatype | Description |
|---|
'tuple[int16_t, int16_t, int16_t]' | Raw accelerometer values (x, y, z). |
IMU.getRawGyroData
getRawGyroData() -> 'tuple[int16_t, int16_t, int16_t]'
Description
Retrieve the raw gyroscope data from the IMU.
Returns
| Datatype | Description |
|---|
'tuple[int16_t, int16_t, int16_t]' | Raw gyroscope values (x, y, z). |
IMU.getRawMagnetometerData
getRawMagnetometerData() -> 'tuple[int16_t, int16_t, int16_t]'
Description
Retrieve the raw magnetometer data from the IMU.
Returns
| Datatype | Description |
|---|
'tuple[int16_t, int16_t, int16_t]' | Raw magnetometer values (x, y, z). |
IMU.getLinearAccelerometerData
getLinearAccelerometerData() -> 'tuple[float, float, float, uint8_t]'
Description
Retrieve the linear accelerometer data from the IMU.
Returns
| Datatype | Description |
|---|
'tuple[float, float, float, uint8_t]' | Linear acceleration values (x, y, z) in m/s² and accuracy. |
IMU.getAccelerometerData
getAccelerometerData() -> 'tuple[float, float, float, uint8_t]'
Description
Retrieve the accelerometer data from the IMU.
Returns
| Datatype | Description |
|---|
'tuple[float, float, float, uint8_t]' | Acceleration values (x, y, z) in m/s² and accuracy. |
IMU.getGyroData
getGyroData() -> 'tuple[float, float, float, uint8_t]'
Description
Retrieve the gyroscope data from the IMU.
Returns
| Datatype | Description |
|---|
'tuple[float, float, float, uint8_t]' | Gyroscope values (x, y, z) in radians per second and accuracy. |
IMU.getMagnetometerData
getMagnetometerData() -> 'tuple[float, float, float, uint8_t]'
Description
Retrieve the magnetometer data from the IMU.
Returns
| Datatype | Description |
|---|
'tuple[float, float, float, uint8_t]' | Magnetometer values (x, y, z) in µT and accuracy. |
IMU.getUncalibratedGyroData
getUncalibratedGyroData() -> 'tuple[float, float, float]'
Description
Retrieve the uncalibrated gyroscope data from the IMU.
Returns
| Datatype | Description |
|---|
'tuple[float, float, float]' | Uncalibrated gyroscope values (x, y, z) in radians per second. |
IMU.getUncalibratedGyroBiasData
getUncalibratedGyroBiasData() -> 'tuple[float, float, float]'
Description
Retrieve the uncalibrated gyroscope bias data from the IMU.
Returns
| Datatype | Description |
|---|
'tuple[float, float, float]' | Uncalibrated gyroscope bias values (x, y, z) in radians per second. |
IMU.getEulerAngles
getEulerAngles() -> 'tuple[float, float, float]'
Description
Retrieve the Euler angles from the IMU.
Returns
| Datatype | Description |
|---|
'tuple[float, float, float]' | Euler angles (yaw, pitch, roll) in degrees. |
IMU.getGravityData
getGravityData() -> 'tuple[float, float, float]'
Description
Retrieve the gravity data from the IMU.
Returns
| Datatype | Description |
|---|
'tuple[float, float, float]' | Gravity vector values (x, y, z) in g. |
IMU.enableRotationVector
enableRotationVector(time_interval: int) -> int
Description
Enable Quaternion rotation vector data and configure report interval.
Returns
| Datatype | Description |
|---|
int | Status code. |
IMU.disableRotationVector
disableRotationVector() -> int
Description
Disable Quaternion rotation vector data stream.
Returns
| Datatype | Description |
|---|
int | Status code. |
IMU.enableRawAccelerometer
enableRawAccelerometer(time_interval: int) -> int
Description
Enable Raw accelerometer data and configure report interval.
Returns
| Datatype | Description |
|---|
int | Status code. |
IMU.disableRawAccelerometer
disableRawAccelerometer() -> int
Description
Disable Raw accelerometer data stream.
Returns
| Datatype | Description |
|---|
int | Status code. |
IMU.enableRawGyro
enableRawGyro(time_interval: int) -> int
Description
Enable Raw gyroscope data and configure report interval.
Returns
| Datatype | Description |
|---|
int | Status code. |
IMU.disableRawGyro
Description
Disable Raw gyroscope data stream.
Returns
| Datatype | Description |
|---|
int | Status code. |
IMU.enableRawMagnetometer
enableRawMagnetometer(time_interval: int) -> int
Description
Enable Raw magnetometer data and configure report interval.
Returns
| Datatype | Description |
|---|
int | Status code. |
IMU.disableRawMagnetometer
disableRawMagnetometer() -> int
Description
Disable Raw magnetometer data stream.
Returns
| Datatype | Description |
|---|
int | Status code. |
IMU.enableLinearAccelerometer
enableLinearAccelerometer(time_interval: int) -> int
Description
Enable Linear accelerometer data and configure report interval.
Returns
| Datatype | Description |
|---|
int | Status code. |
IMU.disableLinearAccelerometer
disableLinearAccelerometer() -> int
Description
Disable Linear accelerometer data stream.
Returns
| Datatype | Description |
|---|
int | Status code. |
IMU.enableAccelerometer
enableAccelerometer(time_interval: int) -> int
Description
Enable Calibrated accelerometer data and configure report interval.
Returns
| Datatype | Description |
|---|
int | Status code. |
IMU.disableAccelerometer
disableAccelerometer() -> int
Description
Disable Calibrated accelerometer data stream.
Returns
| Datatype | Description |
|---|
int | Status code. |
IMU.enableGyro
enableGyro(time_interval: int) -> int
Description
Enable Calibrated gyroscope data and configure report interval.
Returns
| Datatype | Description |
|---|
int | Status code. |
IMU.disableGyro
Description
Disable Calibrated gyroscope data stream.
Returns
| Datatype | Description |
|---|
int | Status code. |
IMU.enableMagnetometer
enableMagnetometer(time_interval: int) -> int
Description
Enable Calibrated magnetometer data and configure report interval.
Returns
| Datatype | Description |
|---|
int | Status code. |
IMU.disableMagnetometer
disableMagnetometer() -> int
Description
Disable Calibrated magnetometer data stream.
Returns
| Datatype | Description |
|---|
int | Status code. |
IMU.enableUncalibratedGyro
enableUncalibratedGyro(time_interval: int) -> int
Description
Enable Uncalibrated gyroscope data and configure report interval.
Returns
| Datatype | Description |
|---|
int | Status code. |
IMU.disableUncalibratedGyro
disableUncalibratedGyro() -> int
Description
Disable Uncalibrated gyroscope data stream.
Returns
| Datatype | Description |
|---|
int | Status code. |
IMU.enableGravity
enableGravity(time_interval: int) -> int
Description
Enable Gravity sensor data and configure report interval.
Returns
| Datatype | Description |
|---|
int | Status code. |
IMU.disableGravity
Description
Disable Gravity sensor data stream.
Returns
| Datatype | Description |
|---|
int | Status code. |