Vector and Matrix Math#

Inertial measurement unit fusion driver math routines.

Functions#

void

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

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
N/Aa

The angle to be normalized


Definition at line 236 of file hardware/driver/imu/inc/sl_imu.h

sl_imu_matrix_multiply#

void sl_imu_matrix_multiply (float c, float a, float b)

Multiply two 3x3 matrices.

Parameters
[out]c

The multiplication result, AB

[in]a

Input vector A

[in]b

Input vector B


Definition at line 251 of file hardware/driver/imu/inc/sl_imu.h

sl_imu_vector_normalize_angle#

void sl_imu_vector_normalize_angle (float v)

Normalize the angle of a vector.

Parameters
N/Av

The vector, which contains angles to be normalized


Definition at line 260 of file hardware/driver/imu/inc/sl_imu.h

sl_imu_vector_zero#

void sl_imu_vector_zero (float v)

Set all elements of a vector to 0.

Parameters
N/Av

The vector to be cleared


Definition at line 269 of file hardware/driver/imu/inc/sl_imu.h

sl_imu_vector_scale#

void sl_imu_vector_scale (float v, float scale)

Scale a vector by a factor.

Parameters
N/Av

The vector to be scaled

[in]scale

The scale factor


Definition at line 281 of file hardware/driver/imu/inc/sl_imu.h

sl_imu_vector_scalar_multiplication#

void sl_imu_vector_scalar_multiplication (float r, float v, 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


Definition at line 296 of file hardware/driver/imu/inc/sl_imu.h

sl_imu_vector_add#

void sl_imu_vector_add (float r, float a, float b)

Add two vectors.

Parameters
[out]r

The vectorial sum of the vectors, a+b

[in]a

The first vector

[in]b

The second vector


Definition at line 311 of file hardware/driver/imu/inc/sl_imu.h

sl_imu_vector_subtract#

void sl_imu_vector_subtract (float r, float a, float b)

Subtract vector b from vector a.

Parameters
[out]r

The vectorial difference, a-b

[in]a

Vector a

[in]b

Vector b


Definition at line 326 of file hardware/driver/imu/inc/sl_imu.h

sl_imu_vector_dot_product#

float sl_imu_vector_dot_product (float a, float b)

Calculate the dot product of two vectors.

Parameters
[in]a

The first vector

[in]b

The second vector

Returns

  • The dot product


Definition at line 341 of file hardware/driver/imu/inc/sl_imu.h

sl_imu_vector_cross_product#

void sl_imu_vector_cross_product (float r, float a, float b)

Calculate the cross product of two vectors.

Parameters
[out]r

The cross product

[in]a

The first vector

[in]b

The second vector


Definition at line 356 of file hardware/driver/imu/inc/sl_imu.h