Khangai Robot Play - Naive  01
THe naive play of the Khangai Robot
State_Sensor Class Referencefinal

#include <state_sensor.h>

Collaboration diagram for State_Sensor:

Public Member Functions

 State_Sensor (State_Sensor &&)=default
 
 State_Sensor (const State_Sensor &)=default
 
State_Sensoroperator= (State_Sensor &&)=default
 
State_Sensoroperator= (const State_Sensor &)=default
 
 ~State_Sensor ()
 
int init (uint32_t dt_millis)
 Function that initializes all the required components for the robot's State Sensor(x, y and yaw) More...
 
Vec3< float > read_State (Vec3< float > base_state, const State_Vars *sv, uint32_t dt_millis)
 Function that provides the state of the robot. More...
 
void add_PSensor (Sensor< float > *sen)
 
void remove_PSensor (Sensor< float > *sen)
 
void change_Sensors (Field field_id)
 
uint8_t get_Bounds ()
 
void update_Position (Vec3< float > pos)
 
void update_IMUOffsets (Vec3< float > offsets)
 

Static Public Member Functions

static State_Sensorget_Instance ()
 

Private Member Functions

 State_Sensor ()
 
Vec3< float > read_Orientation (Vec3< float > base_state, uint32_t dt_millis)
 Function that provides the orientation of the robot. More...
 
Vec3< float > compensate_Bounds (Vec3< float > pos, Vec3< float > ori, const State_Vars *sv)
 

Private Attributes

PositionSensorp_sensor_
 
Bound_Boxbound_box_
 
uint8_t bounds_
 
bool is_first_ori_
 
Vec3< float > first_ori_
 

Constructor & Destructor Documentation

◆ State_Sensor() [1/3]

State_Sensor::State_Sensor ( State_Sensor &&  )
default

◆ State_Sensor() [2/3]

State_Sensor::State_Sensor ( const State_Sensor )
default

◆ ~State_Sensor()

State_Sensor::~State_Sensor ( )
inline

◆ State_Sensor() [3/3]

State_Sensor::State_Sensor ( )
inlineprivate

Member Function Documentation

◆ add_PSensor()

void State_Sensor::add_PSensor ( Sensor< float > *  sen)
inline
Here is the call graph for this function:

◆ change_Sensors()

void State_Sensor::change_Sensors ( Field  field_id)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ compensate_Bounds()

Vec3< float > State_Sensor::compensate_Bounds ( Vec3< float >  pos,
Vec3< float >  ori,
const State_Vars curr_sv 
)
private

Compensates the position values based on the readings from limit switches

Here is the call graph for this function:
Here is the caller graph for this function:

◆ get_Bounds()

uint8_t State_Sensor::get_Bounds ( )
Here is the caller graph for this function:

◆ get_Instance()

State_Sensor & State_Sensor::get_Instance ( )
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ init()

int State_Sensor::init ( uint32_t  dt_millis)

Function that initializes all the required components for the robot's State Sensor(x, y and yaw)

Return values
0if inititialized properly
Tasks performed by this function
1) Call the devices initializations in correct order
2) Call the software initializations for utilities like smoothies and filters

Not yet implemented

Error Condition

Here is the caller graph for this function:

◆ operator=() [1/2]

State_Sensor& State_Sensor::operator= ( State_Sensor &&  )
default

◆ operator=() [2/2]

State_Sensor& State_Sensor::operator= ( const State_Sensor )
default

◆ read_Orientation()

Vec3< float > State_Sensor::read_Orientation ( Vec3< float >  base_state,
uint32_t  dt_millis 
)
private

Function that provides the orientation of the robot.

Parameters
base_stateThis parameter is considered as one of the possible state of robot.
dt_millis: The time period at which this function is called periodically
Return values
orientationof the robot in degrees
Tasks performed by this function
1) Read the values from Accelerometer and the Gyroscope
Here is the call graph for this function:
Here is the caller graph for this function:

◆ read_State()

Vec3< float > State_Sensor::read_State ( Vec3< float >  base_state,
const State_Vars curr_sv,
uint32_t  dt_millis 
)

Function that provides the state of the robot.

Parameters
base_stateThis parameter is considered as one of the possible state of robot. This will be passed to both Orientation_Sensor and the Position_Sensor for further use.
dt_millis: The time period at which this function is called periodically
Return values
stateof the robot
Note
The state of our robot is defined by x,y distance from fences and the Robot's heading
Tasks performed by this function
1) Read Orientation of the robot with Orientation_Sensor
2) Read Position of the robot with Position_Sensor
Here is the call graph for this function:
Here is the caller graph for this function:

◆ remove_PSensor()

void State_Sensor::remove_PSensor ( Sensor< float > *  sen)
inline
Here is the call graph for this function:

◆ update_IMUOffsets()

void State_Sensor::update_IMUOffsets ( Vec3< float >  offsets)

◆ update_Position()

void State_Sensor::update_Position ( Vec3< float >  pos)
inline
Here is the call graph for this function:
Here is the caller graph for this function:

Member Data Documentation

◆ bound_box_

Bound_Box* State_Sensor::bound_box_
private

◆ bounds_

uint8_t State_Sensor::bounds_
private

◆ first_ori_

Vec3<float> State_Sensor::first_ori_
private

◆ is_first_ori_

bool State_Sensor::is_first_ori_
private

◆ p_sensor_

PositionSensor* State_Sensor::p_sensor_
private

The documentation for this class was generated from the following files: