Robot Sensors
Propeller Robot Sensor Objects
 All Classes Functions
isonarsensor.h
1 #ifndef ISONARSENSOR_H
2 #define ISONARSENSOR_H
3 
13 {
14 public:
15  virtual ~ISonarSensor() {};
16 
17  virtual long trigger();
18  virtual long getRange_in();
19  virtual long getRange_cm();
20  virtual int setEnable(int e);
21  virtual int isEnabled();
22 
23 protected:
24  int enabled;
25 };
26 
27 
28 
29 
30 
31 
32 
33 
44 inline long ISonarSensor::trigger()
45 {
46  return -1;
47 }
48 
49 
58 {
59  return -1;
60 }
61 
62 
71 {
72  return -1;
73 }
74 
75 
86 inline int ISonarSensor::setEnable(int e)
87 {
88  if (e)
89  enabled = 1;
90  else
91  enabled = 0;
92 
93  return enabled;
94 }
95 
96 
102 {
103  return enabled;
104 }
105 
106 
107 #endif // ISONARSENSOR_H
virtual int setEnable(int e)
Enable or disable the sensor object.
Definition: isonarsensor.h:86
virtual long getRange_cm()
Get the range in centimeters from the last ranging cycle.
Definition: isonarsensor.h:70
virtual int isEnabled()
Return the enable status of the sensor.
Definition: isonarsensor.h:101
virtual long trigger()
Trigger the sensor to start a ranging session.
Definition: isonarsensor.h:44
virtual long getRange_in()
Get the range in inches from the last ranging cycle.
Definition: isonarsensor.h:57
Virtual interface class for any type of sonar sensor.
Definition: isonarsensor.h:12