Rover API Documentation
rover::RoverHMC5883L Class Reference

RoverHMC5883L is a class that is inherited from RoverSensor abstract class. RoverHMC5883L class contains member functions and variables to set up and read from HMC5883L bearing sensor that is embedded on the rover. More...

#include <rover_hmc5883l.hpp>

Inheritance diagram for rover::RoverHMC5883L:
rover::RoverSensor

Public Member Functions

 RoverHMC5883L ()
 Constructor for the RoverHMC5883L class. More...
 
 ~RoverHMC5883L ()
 Destructor for the RoverHMC5883L class. More...
 
void initialize (void)
 Function to setup HMC5883L sensor. More...
 
float read (void)
 Reads the bearing value from Bearing sensor Sunfounder HMC5883L (float). More...
 
void calibrate (void)
 Starts calibration for the bearing sensor. More...
 
void setHMC588LAddress (const int address)
 Sets the HMC588L Address. More...
 
void setHMC588LCalibrationPeriod (const int period)
 Sets the HMC588L Calibration Duration. More...
 
void setHMC588LDeclinationAngle (const float angle)
 Sets the HMC588L Declination angle. More...
 
int getHMC588LAddress (void)
 Returns the private attribute HMC588L_ADDRESS. More...
 
int getHMC588LCalibrationPeriod (void)
 Returns the HMC588L Calibration Duration. More...
 
float getHMC588LDeclinationAngle (void)
 Returns the HMC588L Declination angle. More...
 
- Public Member Functions inherited from rover::RoverSensor
virtual ~RoverSensor ()
 Destructor for the RoverSensor class. More...
 

Private Member Functions

template<typename T >
MINIMUM_ (const T &a, const T &b)
 Inline macro to find minimum of two values regardles of their types (template). More...
 
template<typename T >
MAXIMUM_ (const T &a, const T &b)
 Inline macro to find maximum of two values regardles of their types (template). More...
 

Private Attributes

int HMC588L_ADDRESS
 Address for compass sensor. More...
 
int CALIBRATION_DURATION
 Calibration duration for compass sensor. More...
 
float DECLINATION_ANGLE
 Declination angle / correction factor for compass sensor. More...
 
unsigned int calibration_start
 Calibration variable for HMC5883L. More...
 
int ROVERHMC5883L_SETUP_
 Flag to hold if HMC5883L is set up. More...
 
int16_t xMinRaw
 Calibration variable to hold the minimum of xRaw results. More...
 
int16_t xMaxRaw
 Calibration variable to hold the maximum of xRaw results. More...
 
int16_t yMinRaw
 Calibration variable to hold the minimum of yRaw results. More...
 
int16_t yMaxRaw
 Calibration variable to hold the maximum of yRaw results. More...
 
int i2c_hmc588l_fd
 Private member attribute for I2C file descriptor. More...
 

Detailed Description

RoverHMC5883L is a class that is inherited from RoverSensor abstract class. RoverHMC5883L class contains member functions and variables to set up and read from HMC5883L bearing sensor that is embedded on the rover.

Constructor & Destructor Documentation

rover::RoverHMC5883L::RoverHMC5883L ( )
explicit

Constructor for the RoverHMC5883L class.

rover::RoverHMC5883L::~RoverHMC5883L ( )

Destructor for the RoverHMC5883L class.

Member Function Documentation

void rover::RoverHMC5883L::calibrate ( void  )

Starts calibration for the bearing sensor.

Returns
void
int rover::RoverHMC5883L::getHMC588LAddress ( void  )

Returns the private attribute HMC588L_ADDRESS.

Returns
address Address to return
int rover::RoverHMC5883L::getHMC588LCalibrationPeriod ( void  )

Returns the HMC588L Calibration Duration.

Returns
period Period to return
float rover::RoverHMC5883L::getHMC588LDeclinationAngle ( void  )

Returns the HMC588L Declination angle.

Returns
angle Declination angle to return
void rover::RoverHMC5883L::initialize ( void  )
virtual

Function to setup HMC5883L sensor.

Returns
void

Implements rover::RoverSensor.

template<typename T >
T rover::RoverHMC5883L::MAXIMUM_ ( const T &  a,
const T &  b 
)
inlineprivate

Inline macro to find maximum of two values regardles of their types (template).

Parameters
aParameter 1
bParameter 2
Returns
maximum value
template<typename T >
T rover::RoverHMC5883L::MINIMUM_ ( const T &  a,
const T &  b 
)
inlineprivate

Inline macro to find minimum of two values regardles of their types (template).

Parameters
aParameter 1
bParameter 2
Returns
minimum value
float rover::RoverHMC5883L::read ( void  )
virtual

Reads the bearing value from Bearing sensor Sunfounder HMC5883L (float).

Returns
bearing_val in degrees (float).

Implements rover::RoverSensor.

void rover::RoverHMC5883L::setHMC588LAddress ( const int  address)

Sets the HMC588L Address.

Parameters
addressAddress to set
Returns
void
void rover::RoverHMC5883L::setHMC588LCalibrationPeriod ( const int  period)

Sets the HMC588L Calibration Duration.

Parameters
periodPeriod to set
Returns
void
void rover::RoverHMC5883L::setHMC588LDeclinationAngle ( const float  angle)

Sets the HMC588L Declination angle.

Parameters
angleDeclination angle to set
Returns
void

Member Data Documentation

int rover::RoverHMC5883L::CALIBRATION_DURATION
private

Calibration duration for compass sensor.

unsigned int rover::RoverHMC5883L::calibration_start
mutableprivate

Calibration variable for HMC5883L.

float rover::RoverHMC5883L::DECLINATION_ANGLE
private

Declination angle / correction factor for compass sensor.

int rover::RoverHMC5883L::HMC588L_ADDRESS
private

Address for compass sensor.

int rover::RoverHMC5883L::i2c_hmc588l_fd
private

Private member attribute for I2C file descriptor.

int rover::RoverHMC5883L::ROVERHMC5883L_SETUP_
private

Flag to hold if HMC5883L is set up.

int16_t rover::RoverHMC5883L::xMaxRaw
private

Calibration variable to hold the maximum of xRaw results.

int16_t rover::RoverHMC5883L::xMinRaw
private

Calibration variable to hold the minimum of xRaw results.

int16_t rover::RoverHMC5883L::yMaxRaw
private

Calibration variable to hold the maximum of yRaw results.

int16_t rover::RoverHMC5883L::yMinRaw
private

Calibration variable to hold the minimum of yRaw results.


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