Rover API Documentation
rover::RoverHCSR04 Class Reference

RoverHCSR04 is a class that is inherited from RoverSensor abstract class. RoverHCSR04 class contains member functions and variables to set up and read from HCSR-04 ultrasonic sensors that are embedded on the rover. More...

#include <rover_hcsr04.hpp>

Inheritance diagram for rover::RoverHCSR04:
rover::RoverSensor

Public Member Functions

 RoverHCSR04 (const RoverSensorID_t sensor_id)
 Constructor for the RoverHCSR04 class. More...
 
 ~RoverHCSR04 ()
 Destructor for the RoverHCSR04 class. More...
 
void initialize (void)
 Function to setup HCSR04 sensor. More...
 
float read (void)
 Member function to read from HC-SR04 ultrasonic sensor given its sensor id. More...
 
void setTrigPin (const int trig_pin)
 Sets the private attribute trigPin for HCSR04. More...
 
int getTrigPin (void)
 Returns the private attribute trigPin for HCSR04. More...
 
void setEchoPin (const int echo_pin)
 Sets the private attribute echoPin for HCSR04. More...
 
int getEchoPin (void)
 Returns the private attribute echoPin for HCSR04. More...
 
- Public Member Functions inherited from rover::RoverSensor
virtual ~RoverSensor ()
 Destructor for the RoverSensor class. More...
 

Private Attributes

RoverSensorID_t sensorID
 Sensor Identification. More...
 
int trigPin
 Trigger pin. More...
 
int echoPin
 Echo pin. More...
 
int ROVERHCSR04_SETUP_
 Flag to hold if RoverHCSR04 is set up. More...
 

Detailed Description

RoverHCSR04 is a class that is inherited from RoverSensor abstract class. RoverHCSR04 class contains member functions and variables to set up and read from HCSR-04 ultrasonic sensors that are embedded on the rover.

Constructor & Destructor Documentation

rover::RoverHCSR04::RoverHCSR04 ( const RoverSensorID_t  sensor_id)
explicit

Constructor for the RoverHCSR04 class.

Parameters
sensor_idSensor to address
rover::RoverHCSR04::~RoverHCSR04 ( )

Destructor for the RoverHCSR04 class.

Member Function Documentation

int rover::RoverHCSR04::getEchoPin ( void  )

Returns the private attribute echoPin for HCSR04.

Returns
echo_pin Pin in wiringPi format for HCSR04
int rover::RoverHCSR04::getTrigPin ( void  )

Returns the private attribute trigPin for HCSR04.

Returns
trig_pin Pin in wiringPi format for HCSR04
void rover::RoverHCSR04::initialize ( void  )
virtual

Function to setup HCSR04 sensor.

Returns
void

Implements rover::RoverSensor.

float rover::RoverHCSR04::read ( void  )
virtual

Member function to read from HC-SR04 ultrasonic sensor given its sensor id.

Returns
sensor_val Sensor value read in centimeters from sensor

Implements rover::RoverSensor.

void rover::RoverHCSR04::setEchoPin ( const int  echo_pin)

Sets the private attribute echoPin for HCSR04.

Parameters
echo_pinPin in wiringPi format for HCSR04
Returns
void
void rover::RoverHCSR04::setTrigPin ( const int  trig_pin)

Sets the private attribute trigPin for HCSR04.

Parameters
trig_pinPin in wiringPi format for HCSR04
Returns
void

Member Data Documentation

int rover::RoverHCSR04::echoPin
private

Echo pin.

int rover::RoverHCSR04::ROVERHCSR04_SETUP_
private

Flag to hold if RoverHCSR04 is set up.

RoverSensorID_t rover::RoverHCSR04::sensorID
private

Sensor Identification.

int rover::RoverHCSR04::trigPin
private

Trigger pin.


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