Package lejos.robotics.objectdetection
Class RangeFeature
- java.lang.Object
-
- 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
Constructors Constructor Description 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
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voiddumpObject(java.io.DataOutputStream dos)PosegetPose()RangeReadinggetRangeReading()Returns the RangeReading for this particular detected feature.RangeReadingsgetRangeReadings()Returns a set of RangeReadings for a number of detected objects.longgetTimeStamp()The time-stamp is the recorded system time when the range reading was taken.voidloadObject(java.io.DataInputStream dis)
-
-
-
Constructor Detail
-
RangeFeature
public RangeFeature(RangeReading rr)
Creates a RangeFeature containing a single RangeReading. If thegetRangeReadings()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. ThegetRangeReading()method will return the RangeReading with the smallest range.- Parameters:
rrs- A (@link RangeReadings} object containing a set ofRangeReadingvalues.
-
RangeFeature
public RangeFeature(RangeReadings rrs, Pose pose)
Creates a RangeFeature containing multiple RangeReadings. ThegetRangeReading()method will return the RangeReading with the smallest range.- Parameters:
rrs- A (@link RangeReadings} object containing a set ofRangeReadingvalues.pose- the pose of the robot when the reading was taken
-
-
Method Detail
-
getRangeReading
public RangeReading getRangeReading()
Description copied from interface:FeatureReturns 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:
getRangeReadingin interfaceFeature- Returns:
- RangeReading object containing angle and range.
-
getTimeStamp
public long getTimeStamp()
Description copied from interface:FeatureThe 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:
getTimeStampin interfaceFeature- Returns:
- The system time (in milliseconds) when the reading was taken.
-
getRangeReadings
public RangeReadings getRangeReadings()
Description copied from interface:FeatureReturns 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:
getRangeReadingsin interfaceFeature- 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:
dumpObjectin interfaceTransmittable- Throws:
java.io.IOException
-
loadObject
public void loadObject(java.io.DataInputStream dis) throws java.io.IOException- Specified by:
loadObjectin interfaceTransmittable- Throws:
java.io.IOException
-
-