Vector and Matrix Math

Description

Inertial measurement unit fusion driver math routines.

Functions

void sl_imu_normalize_angle (float *a)
Normalize the angle ( -PI < angle <= PI )
void sl_imu_matrix_multiply (float c[3][3], float a[3][3], float b[3][3])
Multiply two 3x3 matrices.
void sl_imu_vector_normalize_angle (float v[3])
Normalize the angle of a vector.
void sl_imu_vector_zero (float v[3])
Set all elements of a vector to 0.
void sl_imu_vector_scale (float v[3], float scale)
Scale a vector by a factor.
void sl_imu_vector_scalar_multiplication (float r[3], float v[3], float scale)
Multiply a vector by a scalar.
void sl_imu_vector_add (float r[3], float a[3], float b[3])
Add two vectors.
void sl_imu_vector_subtract (float r[3], float a[3], float b[3])
Subtract vector b from vector a.
float sl_imu_vector_dot_product (float a[3], float b[3])
Calculate the dot product of two vectors.
void sl_imu_vector_cross_product (float r[3], float a[3], float b[3])
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 )

Parameters
a The angle to be normalized

sl_imu_matrix_multiply()

void sl_imu_matrix_multiply ( float c[3][3],
float a[3][3],
float b[3][3]
)

Multiply two 3x3 matrices.

Parameters
[out] c The multiplication result, AB
[in] a Input vector A
[in] b Input vector B

sl_imu_vector_normalize_angle()

void sl_imu_vector_normalize_angle ( float v[3] )

Normalize the angle of a vector.

Parameters
v The vector, which contains angles to be normalized

sl_imu_vector_zero()

void sl_imu_vector_zero ( float v[3] )

Set all elements of a vector to 0.

Parameters
v The vector to be cleared

sl_imu_vector_scale()

void sl_imu_vector_scale ( float v[3],
float scale
)

Scale a vector by a factor.

Parameters
v The vector to be scaled
[in] scale The scale factor

sl_imu_vector_scalar_multiplication()

void sl_imu_vector_scalar_multiplication ( float r[3],
float v[3],
float scale
)

Multiply a vector by a scalar.

Parameters
[out] r The multiplied vector
[in] v The vector to be multiplied
[in] scale The scalar multiplicator value

sl_imu_vector_add()

void sl_imu_vector_add ( float r[3],
float a[3],
float b[3]
)

Add two vectors.

Parameters
[out] r The vectorial sum of the vectors, a+b
[in] a The first vector
[in] b The second vector

sl_imu_vector_subtract()

void sl_imu_vector_subtract ( float r[3],
float a[3],
float b[3]
)

Subtract vector b from vector a.

Parameters
[out] r The vectorial difference, a-b
[in] a Vector a
[in] b Vector b

sl_imu_vector_dot_product()

float sl_imu_vector_dot_product ( float a[3],
float b[3]
)

Calculate the dot product of two vectors.

Parameters
[in] a The first vector
[in] b The second vector
Returns
The dot product

sl_imu_vector_cross_product()

void sl_imu_vector_cross_product ( float r[3],
float a[3],
float b[3]
)

Calculate the cross product of two vectors.

Parameters
[out] r The cross product
[in] a The first vector
[in] b The second vector