orc
Class IRRangeFinder

java.lang.Object
  extended by orc.IRRangeFinder

public class IRRangeFinder
extends java.lang.Object

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
IRRangeFinder(Orc orc, int port)
          Create an IRRangeFinder without any parameters-- useful only when you provide your own parameters.
 
Method Summary
 double getRange()
           
 double[] getRangeAndUncertainty()
          Get the range of the sensor in meters, returning 0 if the sensor appears to be outside its working range.
static IRRangeFinder make2Y0A02(Orc orc, int port)
          Create and return an IRRangeFinder configured with approximate parameters for a Sharp 2Y0A02.
static IRRangeFinder makeGP2D12(Orc orc, int port)
          Create and return an IRRangeFinder configured with approximate parameters for a Sharp GP2D12.
 void setParameters(double Xd, double Xm, double Xb, double voltageStdDev)
          Configure distance and other parameters.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

IRRangeFinder

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

Method Detail

getRangeAndUncertainty

public double[] getRangeAndUncertainty()
Get the range of the sensor in meters, returning 0 if the sensor appears to be outside its working range.


getRange

public double getRange()

setParameters

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


make2Y0A02

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


makeGP2D12

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