MotorController
Functions | Variables
orientation.h File Reference

Go to the source code of this file.

Functions

int32_t set_orientation (int16_t heading)
 Set the euler heading angle offset. More...
 
int32_t set_pitch (int16_t pitch)
 Set the euler pitch angle offset. More...
 
int32_t set_roll (int16_t roll)
 Set the euler roll angle offset. More...
 
int16_t get_relative_heading (void)
 Get the relative heading (relative to the last setting) in trigo sense. More...
 
int16_t get_relative_pitch (void)
 Get the relative pitch angle (relative to the last setting). More...
 
int16_t get_relative_roll (void)
 Get the relative roll angle (relative to the last setting). More...
 
void update_orientation (void)
 Update the current orientation. More...
 

Variables

int16_t orientation
 
int16_t heading_offset
 

Function Documentation

§ get_relative_heading()

int16_t get_relative_heading ( void  )

Get the relative heading (relative to the last setting) in trigo sense.

Returns
The relative heading. The range is [0, 5760] and the value decreases when turning clockwise. The sense of the angle is changed compared to the value returned by the BNO055.

Definition at line 65 of file orientation.c.

§ get_relative_pitch()

int16_t get_relative_pitch ( void  )

Get the relative pitch angle (relative to the last setting).

Returns
The relative pitch. The range is [-2880, 2880] and the value increases when the inclination increases.

Definition at line 115 of file orientation.c.

§ get_relative_roll()

int16_t get_relative_roll ( void  )

Get the relative roll angle (relative to the last setting).

Returns
The relative roll. The range is [-1440, 1440] and the value increases when the inclination increases.

Definition at line 155 of file orientation.c.

§ set_orientation()

int32_t set_orientation ( int16_t  heading)

Set the euler heading angle offset.

WARNING : setting angles DOES NOT MOVE the robot, it offsets the angle.

Parameters
[in]headingThe current heading angle.
Returns
An int32_t indicating success, else an error code.
Return values
NO_ERRORNo error, offset set.
INVALID_PARAMETERheading out of range.

Definition at line 38 of file orientation.c.

§ set_pitch()

int32_t set_pitch ( int16_t  pitch)

Set the euler pitch angle offset.

WARNING : setting angles DOES NOT MOVE the robot, it offsets the angle.

Returns
An int32_t indicating success, else an error code.
Return values
NO_ERRORNo error, offset set.
INVALID_PARAMETERpitch out of range.
Parameters
[in]pitchThe current pitch angle.

Definition at line 90 of file orientation.c.

§ set_roll()

int32_t set_roll ( int16_t  roll)

Set the euler roll angle offset.

WARNING : setting angles DOES NOT MOVE the robot, it offsets the angle.

Returns
An int32_t indicating success, else an error code.
Return values
NO_ERRORNo error, offset set.
INVALID_PARAMETERroll out of range.
Parameters
[in]rollThe current roll angle.

Definition at line 130 of file orientation.c.

§ update_orientation()

void update_orientation ( void  )

Update the current orientation.

This function uses either the IMU or the coding wheels to compute the new orientation value. A threshold on the angular speed is used to select one of the two sources.

Definition at line 169 of file orientation.c.

Variable Documentation

§ heading_offset

int16_t heading_offset

Offset to apply to the raw value given by the IMU.

Definition at line 31 of file orientation.c.

§ orientation

int16_t orientation

The last computed orientation of the robot.

Definition at line 32 of file orientation.c.