Main Page | Class Hierarchy | Alphabetical List | Class List | File List | Class Members | Related Pages

ArSensorReading Class Reference

A class to hold a sensor reading, should be one instance per sensor. More...

#include <ArSensorReading.h>

List of all members.

Public Member Functions

void applyTransform (ArTransform trans)
 Applies a transform to the reading position, and where it was taken.
 ArSensorReading (const ArSensorReading &reading)
 Copy constructor.
 ArSensorReading (double xPos=0.0, double yPos=0.0, double thPos=0.0)
 Constructor, the three args are the physical location of the sensor.
unsigned int getCounterTaken (void) const
 Gets the counter from when the reading arrived.
ArPose getEncoderPoseTaken (void) const
 Gets the encoder pose the reading was taken at.
bool getIgnoreThisReading (void) const
 Gets whether this reading should be ignore or not.
ArPose getLocalPose (void) const
double getLocalX (void) const
 Gets the X location of the sensor reading in local coords.
double getLocalY (void) const
 Gets the Y location of the sensor reading.
ArPose getPose (void) const
ArPose getPoseTaken (void) const
 Gets the pose the reading was taken at.
int getRange (void) const
 Gets the range of the reading.
double getSensorDX (void) const
 Gets the cos component of the heading of the sensor reading.
double getSensorDY (void) const
 Gets the sin component of the heading of the sensor reading.
ArPose getSensorPosition (void) const
 Gets the sensors position on the robot.
double getSensorTh (void) const
 Gets the heading of the sensor on the robot.
double getSensorX (void) const
 Gets the X location of the sonar on the robot.
double getSensorY (void) const
 Gets the Y location of the sensor on the robot.
double getThTaken (void) const
 Gets the th (heading) of the robot when the reading was received.
ArTime getTimeTaken (void) const
double getX (void) const
 Gets the X location of the sensor reading.
double getXTaken (void) const
 Gets the X locaiton of the robot when the reading was received.
double getY (void) const
 Gets the Y location of the sensor reading.
double getYTaken (void) const
 Gets the Y location of the robot when the reading was received.
bool isNew (unsigned int counter) const
 Given the counter from the robot, it returns whether the reading is new.
void newData (int sx, int sy, ArPose robotPose, ArPose encoderPose, ArTransform trans, unsigned int counter, ArTime timeTaken, bool ignoreThisReading=false)
 Takes the data and makes the reading reflect it.
void newData (int range, ArPose robotPose, ArPose encoderPose, ArTransform trans, unsigned int counter, ArTime timeTaken, bool ignoreThisReading=false)
 Takes the data and makes the reading reflect it.
ArSensorReadingoperator= (const ArSensorReading &reading)
 Assignment operator.
void resetSensorPosition (double xPos, double yPos, double thPos, bool forceComputation=false)
 Resets the sensors idea of its physical location on the robot.
void setIgnoreThisReading (bool ignoreThisReading)
 Sets that we should ignore this reading.
virtual ~ArSensorReading ()
 Destructor.

Protected Attributes

double myAngleToCenter
unsigned int myCounterTaken
double myDistToCenter
ArPose myEncoderPoseTaken
bool myIgnoreThisReading
ArPose myLocalReading
int myRange
ArPose myReading
ArPose myReadingTaken
double mySensorCos
ArPose mySensorPos
double mySensorSin
ArTime myTimeTaken


Detailed Description

A class to hold a sensor reading, should be one instance per sensor.

This class holds sensor data and a sensor reading... it can happen that it contains the data for a sonar, but not the reading, in which case the range (from getRange) will be -1, and the counter it was taken (from getCounterTaken) will be 0, also it will never be new (from isNew). If ignoreThisReading returns true then ignore this reading (its still here since this is used for raw data).

Definition at line 43 of file ArSensorReading.h.


Constructor & Destructor Documentation

ArSensorReading::ArSensorReading double  xPos = 0.0,
double  yPos = 0.0,
double  thPos = 0.0
 

Constructor, the three args are the physical location of the sensor.

Parameters:
xPos the x position of the sensor on the robot (mm)
yPos the y position of the sensor on the robot (mm)
thPos the heading of the sensor on the robot (deg)

Definition at line 37 of file ArSensorReading.cpp.

References resetSensorPosition(), and ArPose::setPose().


Member Function Documentation

void ArSensorReading::applyTransform ArTransform  trans  ) 
 

Applies a transform to the reading position, and where it was taken.

Parameters:
trans the transform to apply to the reading and where the reading was taken

Definition at line 177 of file ArSensorReading.cpp.

References ArTransform::doTransform().

Referenced by ArRobot::applyTransform(), and ArRobot::moveTo().

unsigned int ArSensorReading::getCounterTaken void   )  const [inline]
 

Gets the counter from when the reading arrived.

Returns:
the counter from the robot when the sonar reading was taken
See also:
isNew

Definition at line 124 of file ArSensorReading.h.

ArPose ArSensorReading::getLocalPose void   )  const [inline]
 

Gets the position of the reading

Returns:
the position of the reading (ie where the sonar pinged back)

Definition at line 82 of file ArSensorReading.h.

ArPose ArSensorReading::getPose void   )  const [inline]
 

Gets the position of the reading

Returns:
the position of the reading (ie where the sonar pinged back)

Definition at line 74 of file ArSensorReading.h.

int ArSensorReading::getRange void   )  const [inline]
 

Gets the range of the reading.

Returns:
the distance return from the sensor (how far from the robot)

Definition at line 59 of file ArSensorReading.h.

Referenced by ArRobot::getClosestSonarNumber().

ArPose ArSensorReading::getSensorPosition void   )  const [inline]
 

Gets the sensors position on the robot.

Returns:
the position of the sensor on the robot

Definition at line 105 of file ArSensorReading.h.

bool ArSensorReading::isNew unsigned int  counter  )  const [inline]
 

Given the counter from the robot, it returns whether the reading is new.

Parameters:
counter the counter from the robot at the current time
Returns:
true if the reading was taken on the current loop
See also:
getCounter

Definition at line 67 of file ArSensorReading.h.

Referenced by ArSonarDevice::processReadings().

void ArSensorReading::newData int  sx,
int  sy,
ArPose  robotPose,
ArPose  encoderPose,
ArTransform  trans,
unsigned int  counter,
ArTime  timeTaken,
bool  ignoreThisReading = false
 

Takes the data and makes the reading reflect it.

Parameters:
sx the coords of the sensor return relative to sensor (mm)
sy the coords of the sensor return relative to sensor (mm)
robotPose the robot's pose when the reading was taken
encoderPose the robot's encoder pose when the reading was taken
th the heading of the robot when the sensor reading was taken (deg)
counter the counter from the robot when the sensor reading was taken
timeTaken the time the reading was taken
ignoreThisReading if this reading should be ignored or not

Definition at line 131 of file ArSensorReading.cpp.

References ArTransform::doTransform(), getSensorX(), getSensorY(), and ArPose::setPose().

void ArSensorReading::newData int  range,
ArPose  robotPose,
ArPose  encoderPose,
ArTransform  trans,
unsigned int  counter,
ArTime  timeTaken,
bool  ignoreThisReading = false
 

Takes the data and makes the reading reflect it.

Parameters:
range the distance from the sensor to the sensor return (mm)
robotPose the robot's pose when the reading was taken
encoderPose the robot's encoder pose when the reading was taken
trans the transform from local coords to global coords
counter the counter from the robot when the sensor reading was taken
timeTaken the time the reading was taken
ignoreThisReading if this reading should be ignored or not

Definition at line 101 of file ArSensorReading.cpp.

References ArTransform::doTransform(), getSensorX(), getSensorY(), and ArPose::setPose().

Referenced by ArIrrfDevice::packetHandler(), ArRobot::processNewSonar(), ArSick::processPacket(), and ArSick::simPacketHandler().

void ArSensorReading::resetSensorPosition double  xPos,
double  yPos,
double  thPos,
bool  forceComputation = false
 

Resets the sensors idea of its physical location on the robot.

Parameters:
xPos the x position of the sensor on the robot (mm)
yPos the y position of the sensor on the robot (mm)
thPos the heading of the sensor on the robot (deg)

Definition at line 156 of file ArSensorReading.cpp.

References ArMath::atan2(), ArMath::cos(), ArPose::getTh(), ArPose::getX(), ArPose::getY(), ArPose::setPose(), and ArMath::sin().

Referenced by ArSensorReading(), ArSick::processPacket(), and ArSick::simPacketHandler().


The documentation for this class was generated from the following files:
Generated on Wed Oct 19 12:56:54 2005 for Aria by  doxygen 1.4.0