maslab.orc
Class IRRangeSensor

java.lang.Object
  extended by maslab.orc.IRRangeSensor
All Implemented Interfaces:
RangeSensor

public class IRRangeSensor
extends java.lang.Object
implements RangeSensor

Orc wrapper for Infra-red range sensors. The manufacturer (Sharp) suggests that a line can be fit to a function of the form 1/(d + Xd), where d is the distance and Xd is some calibration value. We use parameters Xm and Xb as the parameters of the line. V = 1/(d + Xd) * Xm + Xb Solving for d: d = (Xm/(V-Xb)) - Xd


Constructor Summary
IRRangeSensor(Orc orc, int port)
          Create an IRRangeSensor without any parameters-- useful only when you provide your own parameters.
 
Method Summary
 double getArcAngle()
          The rough interior angle of the arc upon which an object might lie, in radians.
 double getRange()
          Distance that the sensor currently is measuring, in meters.
 double getRangeUncertainty()
          Variance of the sensor's current measurement.
static IRRangeSensor make2Y0A02(Orc orc, int port)
          Create and return an IRRangeSensor configured with approximate parameters for a Sharp 2Y0A02.
static IRRangeSensor makeGP2D12(Orc orc, int port)
          Create and return an IRRangeSensor configured with approximate parameters for a Sharp GP2D12.
 void setParameters(double Xd, double Xm, double Xb)
          Configure the distance parameters.
 void setParameters(double Xd, double Xm, double Xb, double arcAngle, double voltageVariance)
          Configure distance and other parameters.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

IRRangeSensor

public IRRangeSensor(Orc orc,
                     int port)
Create an IRRangeSensor without any parameters-- useful only when you provide your own parameters. Otherwise, use (e.g.) makeGP2D12.

Method Detail

setParameters

public void setParameters(double Xd,
                          double Xm,
                          double Xb)
Configure the distance parameters. These parameters can be generated by collecting distance/voltage data and fitting the parameters with the equation listed above.


setParameters

public void setParameters(double Xd,
                          double Xm,
                          double Xb,
                          double arcAngle,
                          double voltageVariance)
Configure distance and other parameters.


make2Y0A02

public static IRRangeSensor make2Y0A02(Orc orc,
                                       int port)
Create and return an IRRangeSensor configured with approximate parameters for a Sharp 2Y0A02.


makeGP2D12

public static IRRangeSensor makeGP2D12(Orc orc,
                                       int port)
Create and return an IRRangeSensor configured with approximate parameters for a Sharp GP2D12.


getRange

public double getRange()
Description copied from interface: RangeSensor
Distance that the sensor currently is measuring, in meters.

Specified by:
getRange in interface RangeSensor

getRangeUncertainty

public double getRangeUncertainty()
Description copied from interface: RangeSensor
Variance of the sensor's current measurement. Compute square root for standard deviation.

Specified by:
getRangeUncertainty in interface RangeSensor

getArcAngle

public double getArcAngle()
Description copied from interface: RangeSensor
The rough interior angle of the arc upon which an object might lie, in radians. In general, can be a function of the sensor's current measurement.

Specified by:
getArcAngle in interface RangeSensor