Vector and Matrix Math#
Inertial measurement unit fusion driver math routines.
Functions#
Normalize the angle ( -PI < angle <= PI )
Multiply two 3x3 matrices.
Normalize the angle of a vector.
Set all elements of a vector to 0.
Scale a vector by a factor.
Multiply a vector by a scalar.
Add two vectors.
Subtract vector b from vector a.
Calculate the dot product of two vectors.
Calculate the cross product of two vectors.
Function Documentation#
sl_imu_normalize_angle#
void sl_imu_normalize_angle (float * a)
Normalize the angle ( -PI < angle <= PI )
Type | Direction | Argument Name | Description |
---|---|---|---|
float * | N/A | a | The angle to be normalized |
sl_imu_matrix_multiply#
void sl_imu_matrix_multiply (float c, float a, float b)
Multiply two 3x3 matrices.
Type | Direction | Argument Name | Description |
---|---|---|---|
float | [out] | c | The multiplication result, AB |
float | [in] | a | Input vector A |
float | [in] | b | Input vector B |
sl_imu_vector_normalize_angle#
void sl_imu_vector_normalize_angle (float v)
Normalize the angle of a vector.
Type | Direction | Argument Name | Description |
---|---|---|---|
float | N/A | v | The vector, which contains angles to be normalized |
sl_imu_vector_zero#
void sl_imu_vector_zero (float v)
Set all elements of a vector to 0.
Type | Direction | Argument Name | Description |
---|---|---|---|
float | N/A | v | The vector to be cleared |
sl_imu_vector_scale#
void sl_imu_vector_scale (float v, float scale)
Scale a vector by a factor.
Type | Direction | Argument Name | Description |
---|---|---|---|
float | N/A | v | The vector to be scaled |
float | [in] | scale | The scale factor |
sl_imu_vector_scalar_multiplication#
void sl_imu_vector_scalar_multiplication (float r, float v, float scale)
Multiply a vector by a scalar.
Type | Direction | Argument Name | Description |
---|---|---|---|
float | [out] | r | The multiplied vector |
float | [in] | v | The vector to be multiplied |
float | [in] | scale | The scalar multiplicator value |
sl_imu_vector_add#
void sl_imu_vector_add (float r, float a, float b)
Add two vectors.
Type | Direction | Argument Name | Description |
---|---|---|---|
float | [out] | r | The vectorial sum of the vectors, a+b |
float | [in] | a | The first vector |
float | [in] | b | The second vector |
sl_imu_vector_subtract#
void sl_imu_vector_subtract (float r, float a, float b)
Subtract vector b from vector a.
Type | Direction | Argument Name | Description |
---|---|---|---|
float | [out] | r | The vectorial difference, a-b |
float | [in] | a | Vector a |
float | [in] | b | Vector b |
sl_imu_vector_dot_product#
float sl_imu_vector_dot_product (float a, float b)
Calculate the dot product of two vectors.
Type | Direction | Argument Name | Description |
---|---|---|---|
float | [in] | a | The first vector |
float | [in] | b | The second vector |
Returns
The dot product
sl_imu_vector_cross_product#
void sl_imu_vector_cross_product (float r, float a, float b)
Calculate the cross product of two vectors.
Type | Direction | Argument Name | Description |
---|---|---|---|
float | [out] | r | The cross product |
float | [in] | a | The first vector |
float | [in] | b | The second vector |