|
RoboJDETM v2.0 | |||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.ridgesoft.robotics.sensors.SharpGP2D12
public class SharpGP2D12
Class to interface with the Sharp GP2D12 infrared range finder.
Field Summary | |
---|---|
protected AnalogInput |
mInput
|
protected DigitalOutput |
mPowerControl
|
protected int |
mSample
|
protected float |
mScaleFactor
|
Constructor Summary | |
---|---|
SharpGP2D12(AnalogInput input,
DigitalOutput powerControl)
Constructs a SharpGP2D12 range finder object. |
Method Summary | |
---|---|
float |
getDistanceCm()
Gets the distance to the nearest object in centimeters based on an curve fitting apporximation of the output voltage verse distance curve. |
float |
getDistanceInches()
Gets the distance to the nearest object in inches based on an curve fitting apporximation of the output voltage verse distance curve. |
void |
ping()
Powers the sensor on if necessary and takes a sample. |
Methods inherited from class java.lang.Object |
---|
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait |
Field Detail |
---|
protected AnalogInput mInput
protected DigitalOutput mPowerControl
protected int mSample
protected float mScaleFactor
Constructor Detail |
---|
public SharpGP2D12(AnalogInput input, DigitalOutput powerControl)
input
- analog input receiving sensor outputpowerControl
- digital output used to control the power to the sensor. Should
be null if power is always on. When power switching is used,
the ping method sleeps for 70 milliseconds after powering up
the sensor.Method Detail |
---|
public float getDistanceCm()
getDistanceCm
in interface RangeFinder
public float getDistanceInches()
getDistanceInches
in interface RangeFinder
public void ping()
Note: The sensor has an ~50 millisecond sample frequency. This method sleeps for 70 milliseconds after powering the sensor on if a powerEnable was provided in the constructor.
ping
in interface RangeFinder
|
RoboJDETM v2.0 | |||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |