Aria  2.8.0
ArSensorReading Class Reference

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

#include <ArSensorReading.h>

Public Member Functions

void applyEncoderTransform (ArTransform trans)
 Applies a transform to the encoder pose taken. More...
 
void applyTransform (ArTransform trans)
 Applies a transform to the reading position, and where it was taken. More...
 
 ArSensorReading (double xPos=0.0, double yPos=0.0, double thPos=0.0)
 Constructor, the three args are the physical location of the sensor. More...
 
 ArSensorReading (const ArSensorReading &reading)
 Copy constructor.
 
bool getAdjusted (void)
 Applies a transform to the reading position, and where it was taken.
 
unsigned int getCounterTaken (void) const
 Gets the counter from when the reading arrived. More...
 
ArPose getEncoderPoseTaken (void) const
 Gets the robot's encoder pose the reading was taken at. More...
 
int getExtraInt (void) const
 Gets the extra int with this reading. More...
 
bool getIgnoreThisReading (void) const
 Gets whether this reading should be ignore or not. More...
 
ArPose getLocalPose (void) const
 Gets the position of the reading. More...
 
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
 Gets the position of the reading. More...
 
ArPose getPoseTaken (void) const
 Gets the pose of the robot at which the reading was taken. More...
 
unsigned int getRange (void) const
 Gets the range from sensor of the reading. More...
 
double getSensorDX (void) const
 Gets the cosine component of the heading of the sensor reading.
 
double getSensorDY (void) const
 Gets the sine component of the heading of the sensor reading.
 
ArPose getSensorPosition (void) const
 Gets the sensor's position on the robot. More...
 
double getSensorTh (void) const
 Gets the heading of the sensor on the robot. More...
 
double getSensorX (void) const
 Gets the X location of the sonar on the robot. More...
 
double getSensorY (void) const
 Gets the Y location of the sensor on the robot. More...
 
double getThTaken (void) const
 Gets the th (heading) of the robot when the reading was received. More...
 
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. More...
 
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. More...
 
bool isNew (unsigned int counter) const
 Given the counter from the robot, it returns whether the reading is new. More...
 
void newData (int range, ArPose robotPose, ArPose encoderPose, ArTransform trans, unsigned int counter, ArTime timeTaken, bool ignoreThisReading=false, int extraInt=0)
 Takes the data and makes the reading reflect it. More...
 
void newData (int sx, int sy, ArPose robotPose, ArPose encoderPose, ArTransform trans, unsigned int counter, ArTime timeTaken, bool ignoreThisReading=false, int extraInt=0)
 Takes the data and makes the reading reflect it. More...
 
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. More...
 
void setAdjusted (bool adjusted)
 Applies a transform to the reading position, and where it was taken.
 
void setExtraInt (int extraInt)
 Sets the extra int.
 
void setIgnoreThisReading (bool ignoreThisReading)
 Sets that we should ignore this reading.
 
virtual ~ArSensorReading ()
 Destructor.
 

Protected Attributes

bool myAdjusted
 
double myAngleToCenter
 
unsigned int myCounterTaken
 
double myDistToCenter
 
ArPose myEncoderPoseTaken
 
int myExtraInt
 
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).

Constructor & Destructor Documentation

◆ ArSensorReading()

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
xPosthe x position of the sensor on the robot (mm)
yPosthe y position of the sensor on the robot (mm)
thPosthe heading of the sensor on the robot (deg)

Member Function Documentation

◆ applyEncoderTransform()

void ArSensorReading::applyEncoderTransform ( ArTransform  trans)

Applies a transform to the encoder pose taken.

Parameters
transthe transform to apply to the encoder pose taken

◆ applyTransform()

void ArSensorReading::applyTransform ( ArTransform  trans)

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

Parameters
transthe transform to apply to the reading and where the reading was taken

◆ getCounterTaken()

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

◆ getEncoderPoseTaken()

ArPose ArSensorReading::getEncoderPoseTaken ( void  ) const
inline

Gets the robot's encoder pose the reading was taken at.

See also
getPoseTaken()
ArRobot::getEncoderPose()

◆ getExtraInt()

int ArSensorReading::getExtraInt ( void  ) const
inline

Gets the extra int with this reading.

Some range devices provide extra device-dependent information with each reading. What that means depends on the range device, if a range device doesn't give the meaning in its constructor description then it has no meaning at all.

Note that for all laser like devices this should be a value between 0 - 255 which is the measure of reflectance. It should be 0 if that device doesn't measure reflectance (the default).

◆ getIgnoreThisReading()

bool ArSensorReading::getIgnoreThisReading ( void  ) const
inline

Gets whether this reading should be ignore or not.

e.g. the sensor encountered an error or did not actually detect anything.

◆ getLocalPose()

ArPose ArSensorReading::getLocalPose ( void  ) const
inline

Gets the position of the reading.

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

◆ getPose()

ArPose ArSensorReading::getPose ( void  ) const
inline

Gets the position of the reading.

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

◆ getPoseTaken()

ArPose ArSensorReading::getPoseTaken ( void  ) const
inline

Gets the pose of the robot at which the reading was taken.

See also
getEncoderPoseTaken()
getTimeTaken()
ArRobot::getPose()

◆ getRange()

unsigned int ArSensorReading::getRange ( void  ) const
inline

Gets the range from sensor of the reading.

Returns
the distance to the reading from the sensor itself

◆ getSensorPosition()

ArPose ArSensorReading::getSensorPosition ( void  ) const
inline

Gets the sensor's position on the robot.

Returns
the position of the sensor on the robot

◆ getSensorTh()

double ArSensorReading::getSensorTh ( void  ) const
inline

Gets the heading of the sensor on the robot.

See also
getsensorPosition()

◆ getSensorX()

double ArSensorReading::getSensorX ( void  ) const
inline

Gets the X location of the sonar on the robot.

See also
getSensorPosition()

◆ getSensorY()

double ArSensorReading::getSensorY ( void  ) const
inline

Gets the Y location of the sensor on the robot.

See also
getsensorPosition()

◆ getThTaken()

double ArSensorReading::getThTaken ( void  ) const
inline

Gets the th (heading) of the robot when the reading was received.

See also
getPoseTaken()

◆ getXTaken()

double ArSensorReading::getXTaken ( void  ) const
inline

Gets the X locaiton of the robot when the reading was received.

See also
getPoseTaken()

◆ getYTaken()

double ArSensorReading::getYTaken ( void  ) const
inline

Gets the Y location of the robot when the reading was received.

See also
getPoseTaken()

◆ isNew()

bool ArSensorReading::isNew ( unsigned int  counter) const
inline

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

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

◆ newData() [1/2]

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

Takes the data and makes the reading reflect it.

Parameters
rangethe distance from the sensor to the sensor return (mm)
robotPosethe robot's pose when the reading was taken
encoderPosethe robot's encoder pose when the reading was taken
transthe transform from local coords to global coords
counterthe counter from the robot when the sensor reading was taken
timeTakenthe time the reading was taken
ignoreThisReadingif this reading should be ignored or not
extraIntextra laser device-specific value associated with this reading (e.g. SICK LMS-200 reflectance)

◆ newData() [2/2]

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

Takes the data and makes the reading reflect it.

Parameters
sxthe coords of the sensor return relative to sensor (mm)
sythe coords of the sensor return relative to sensor (mm)
robotPosethe robot's pose when the reading was taken
encoderPosethe robot's encoder pose when the reading was taken
transtransform of reading from local to global position
counterthe counter from the robot when the sensor reading was taken
timeTakenthe time the reading was taken
ignoreThisReadingif this reading should be ignored or not
extraIntextra laser device-specific value associated with this reading (e.g. SICK LMS-200 reflectance)

◆ resetSensorPosition()

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

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

Parameters
xPosthe x position of the sensor on the robot (mm)
yPosthe y position of the sensor on the robot (mm)
thPosthe heading of the sensor on the robot (deg)
forceComputationrecompute position even if new position is the same as current

The documentation for this class was generated from the following files: