lejos.robotics.objectdetection
Class RangeFeature

java.lang.Object
  extended by lejos.robotics.objectdetection.RangeFeature
All Implemented Interfaces:
Feature, Transmittable

public class RangeFeature
extends java.lang.Object
implements Feature, Transmittable

This class is a basic data container for information retrieved about an object detected by sensors. The RangeFeature contains only the most basic range information of a detected object, which is RangeReading. The RangeReading contains range and angle data relative to the robot.

It can be extended to include more information, such as color. For example, a ColorFeature would rely on a ColorFeatureDetector to supply color information and range. The ColorFeatureDetector could extend FeatureDetector and accept a camera in the constructor to identify color of a detected object. This type of class would be useful to allow soccer robots to identify team-mates, the soccer ball, and the different goals.

Author:
BB

Constructor Summary
RangeFeature(RangeReading rr)
          Creates a RangeFeature containing a single RangeReading.
RangeFeature(RangeReadings rrs)
          Creates a RangeFeature containing multiple RangeReadings.
RangeFeature(RangeReadings rrs, Pose pose)
          Creates a RangeFeature containing multiple RangeReadings.
 
Method Summary
 void dumpObject(java.io.DataOutputStream dos)
           
 Pose getPose()
           
 RangeReading getRangeReading()
          Returns the RangeReading for this particular detected feature.
 RangeReadings getRangeReadings()
          Returns a set of RangeReadings for a number of detected objects.
 long getTimeStamp()
          The time-stamp is the recorded system time when the range reading was taken.
 void loadObject(java.io.DataInputStream dis)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

RangeFeature

public RangeFeature(RangeReading rr)
Creates a RangeFeature containing a single RangeReading. If the getRangeReadings() method is subsequently called, it will return a RangeReadings set containing only one RangeReading (rr).

Parameters:
rr - The RangeReading.

RangeFeature

public RangeFeature(RangeReadings rrs)
Creates a RangeFeature containing multiple RangeReadings. The getRangeReading() method will return the RangeReading with the smallest range.

Parameters:
rrs - A (@link RangeReadings} object containing a set of RangeReading values.

RangeFeature

public RangeFeature(RangeReadings rrs,
                    Pose pose)
Creates a RangeFeature containing multiple RangeReadings. The getRangeReading() method will return the RangeReading with the smallest range.

Parameters:
rrs - A (@link RangeReadings} object containing a set of RangeReading values.
pose - the pose of the robot when the reading was taken
Method Detail

getRangeReading

public RangeReading getRangeReading()
Description copied from interface: Feature
Returns the RangeReading for this particular detected feature. If the sensor is capable of detecting multiple objects, this method will return the closest object it detected.

Specified by:
getRangeReading in interface Feature
Returns:
RangeReading object containing angle and range.

getTimeStamp

public long getTimeStamp()
Description copied from interface: Feature
The time-stamp is the recorded system time when the range reading was taken. This is generally recorded in the constructor of the Feature implementation. The time-stamp can help identify the vector of the detected object.

Specified by:
getTimeStamp in interface Feature
Returns:
The system time (in milliseconds) when the reading was taken.

getRangeReadings

public RangeReadings getRangeReadings()
Description copied from interface: Feature
Returns a set of RangeReadings for a number of detected objects. If the sensor is only capable of returning a single reading, or if only one object was detected, it will only contain one RangeReading in the set.

Specified by:
getRangeReadings in interface Feature
Returns:
RangeReadings object containing a set of RangeReading objects.

getPose

public Pose getPose()

dumpObject

public void dumpObject(java.io.DataOutputStream dos)
                throws java.io.IOException
Specified by:
dumpObject in interface Transmittable
Throws:
java.io.IOException

loadObject

public void loadObject(java.io.DataInputStream dis)
                throws java.io.IOException
Specified by:
loadObject in interface Transmittable
Throws:
java.io.IOException