#include <GT2004SelfLocator.h>
Inheritance diagram for GT2004SelfLocator:
Public Member Functions | |
GT2004SelfLocator (const SelfLocatorInterfaces &interfaces) | |
Constructor. | |
virtual void | execute () |
The function executes the module. | |
virtual bool | handleMessage (InMessage &message) |
Called from a MessageQueue to distribute messages. | |
Static Public Attributes | |
double | paramUp |
double | paramDown |
double | paramDelay |
double | paramHeight |
double | paramZ |
double | paramY |
double | paramR |
double | paramTrans |
double | paramRot |
Private Types | |
enum | { SAMPLES_MAX = 100, GRID_MAX = 10, FLAGS_MAX = 3 } |
enum | FlagSides { LEFT_SIDE_OF_FLAG = 1, RIGHT_SIDE_OF_FLAG = -1 } |
Private Member Functions | |
double | sigmoid (double d) const |
The function distributes the parameter in a Gaussian way. | |
void | updateByOdometry (const Pose2D &odometry, const Pose2D &camera, bool noise) |
The function updates the samples by the odometry offset. | |
void | updateByPoint (const LinesPercept::LinePoint &point, LinesPercept::LineType type) |
The function updates the samples by a single line point recognized. | |
void | updateByFlag (const Vector2< double > &flag, FlagSides sideOfFlag, double measuredBearing) |
The function updates the samples by a single edge of a flag recognized. | |
void | updateByGoalPost (const Vector2< double > &goalPost, double measuredBearing) |
The function updates the samples by a single goal post recognized. | |
void | resample () |
The function re-distributes the samples according to their probabilities. | |
void | calcPose (Pose2D &pose, double &validity) |
The function determines the most probable pose from the sample distribution. | |
void | addFlag (const Flag &flag) |
The function adds a flag to the buffer. | |
bool | poseFromBearings (double dir0, double dir1, double dir2, const Vector2< double > &mark0, const Vector2< double > &mark1, const Vector2< double > &mark2, const Vector2< double > &cameraOffset, Pose2D &resultingPose) const |
The function calculates the current pose of the robot from three bearings. | |
int | poseFromBearingsAndDistance (double dir0, double dir1, double dist, const Vector2< double > &mark0, const Vector2< double > &mark1, const Vector2< double > &cameraOffset, Pose2D &resultingPose1, Pose2D &resultingPose2) const |
The function calculates the up to two current poses of the robot from two bearings and a distance. | |
bool | getBearing (const LandmarksPercept &landmarksPercept, int i, Vector2< double > &mark, double &dir, double &dist) const |
The function determines a pair of landmark positions and bearings from a landmarks percept. | |
void | generatePoseTemplates (const LandmarksPercept &landmarksPercept, const Pose2D &odometry) |
The function generates pose templates from a landmark percept. | |
Sample | getTemplate () |
The function returns the next pose template or a random one if no templates were determined. | |
void | draw (const Pose2D &pose, Drawings::Color color) const |
The function draws an arrow to a debug drawing. | |
void | draw (const Vector2< int > &point, LinesPercept::LineType type) const |
The function draws a point of a line percept. | |
Private Attributes | |
DistanceToBorderEstimator | distanceToBorderEstimator |
A class that can estimate the distance to the border. | |
SampleSet< Sample, SAMPLES_MAX > | sampleSet |
The sample set. | |
Pose2D | lastOdometry |
The state of the odometry at the previous call of this module. | |
Pose2D | lastOdometry2 |
The state of the odometry at the previous call of this module. | |
Pose2D | templates [SAMPLES_MAX] |
Templates for poses replacing bad samples. | |
Flag | flags [FLAGS_MAX] |
A buffer for previously seen flags. | |
int | numOfFlags |
The number of flags in the buffer. | |
int | numOfTemplates |
The number of templates generated. | |
int | nextTemplate |
The next template delivered. | |
int | randomFactor |
A factor that is increased if more templates are required. | |
LinesPercept::LineType | types [LinesPercept::numberOfLineTypes] |
int | numberOfTypes |
bool | sensorUpdated |
Did any update of the samples by a sensor reading happen? | |
double | average [Sample::numberOfQualities] |
unsigned | timeStamp |
double | speed |
Definition at line 21 of file GT2004SelfLocator.h.
|
Definition at line 79 of file GT2004SelfLocator.h. |
|
Definition at line 86 of file GT2004SelfLocator.h. |
|
Constructor.
Definition at line 87 of file GT2004SelfLocator.cpp. References average, distanceToBorderEstimator, numOfFlags, Field::randomPose(), SAMPLES_MAX, sampleSet, and sensorUpdated. |
Here is the call graph for this function:
|
The function distributes the parameter in a Gaussian way.
Definition at line 113 of file GT2004SelfLocator.h. Referenced by updateByFlag(), updateByGoalPost(), and updateByPoint(). |
|
The function updates the samples by the odometry offset.
Definition at line 214 of file GT2004SelfLocator.cpp. References Vector2< double >::abs(), GT2004SelfLocator::Sample::camera, fmax(), Pose2D::getAngle(), max, PoseSample::probability, random(), SAMPLES_MAX, sampleSet, Pose2D::translation, Vector2< double >::x, and Vector2< double >::y. Referenced by execute(). |
Here is the call graph for this function:
|
The function updates the samples by a single line point recognized.
Definition at line 258 of file GT2004SelfLocator.cpp. References Vector2< V >::abs(), Vector2< int >::abs(), Vector2< int >::angle(), COMPLEX_DRAWING, draw(), Pose2D::getAngle(), ObservationTable< 280, 200, 25 >::getClosestPoint(), getPlayer(), Player::getTeamColor(), paramHeight, paramY, paramZ, pi, point, SAMPLES_MAX, sampleSet, GT2004SelfLocator::Sample::setProbability(), sigmoid(), Pose2D::translation, Vector2< V >::x, Vector2< int >::x, Vector2< V >::y, and Vector2< int >::y. Referenced by execute(). |
Here is the call graph for this function:
|
The function updates the samples by a single edge of a flag recognized.
Definition at line 292 of file GT2004SelfLocator.cpp. References Vector2< double >::abs(), GT2004SelfLocator::Sample::camera, pi, SAMPLES_MAX, sampleSet, sensorUpdated, GT2004SelfLocator::Sample::setProbability(), sigmoid(), Pose2D::translation, Vector2< double >::x, Vector2< V >::x, Vector2< double >::y, and Vector2< V >::y. Referenced by execute(). |
Here is the call graph for this function:
|
The function updates the samples by a single goal post recognized.
Definition at line 310 of file GT2004SelfLocator.cpp. References GT2004SelfLocator::Sample::camera, pi, SAMPLES_MAX, sampleSet, sensorUpdated, GT2004SelfLocator::Sample::setProbability(), sigmoid(), Pose2D::translation, Vector2< double >::x, Vector2< V >::x, Vector2< double >::y, and Vector2< V >::y. Referenced by execute(). |
Here is the call graph for this function:
|
The function re-distributes the samples according to their probabilities.
Definition at line 327 of file GT2004SelfLocator.cpp. References average, COMPLEX_DRAWING, draw(), GT2004SelfLocator::Sample::getQuality(), getTemplate(), numOfTemplates, GT2004SelfLocator::Sample::quality, random(), SAMPLES_MAX, sampleSet, and SampleSet< Sample, SAMPLES_MAX >::swap(). Referenced by execute(). |
Here is the call graph for this function:
|
The function determines the most probable pose from the sample distribution.
Definition at line 393 of file GT2004SelfLocator.cpp. References Field::clip(), GT2004SelfLocator::Cell::count, GT2004SelfLocator::Cell::first, Pose2D::getAngle(), Pose2D::getCos(), GT2004SelfLocator::Sample::getQuality(), Pose2D::getSin(), Range< double >::getSize(), GRID_MAX, GT2004SelfLocator::Sample::isValid(), GT2004SelfLocator::Sample::next, pi2, SAMPLES_MAX, sampleSet, Pose2D::translation, Vector2< double >::x, Boundary< double >::x, Vector2< double >::y, and Boundary< double >::y. Referenced by execute(). |
Here is the call graph for this function:
|
The function adds a flag to the buffer.
Definition at line 611 of file GT2004SelfLocator.cpp. References FLAGS_MAX, ConditionalBoundary::isOnBorder(), Range< double >::max, Range< double >::min, numOfFlags, Flag::type, and Boundary< double >::x. Referenced by generatePoseTemplates(). |
Here is the call graph for this function:
|
The function calculates the current pose of the robot from three bearings.
Definition at line 498 of file GT2004SelfLocator.cpp. References Vector2< V >::abs(), pi, pi2, Vector2< V >::x, and Vector2< V >::y. Referenced by generatePoseTemplates(). |
Here is the call graph for this function:
|
The function calculates the up to two current poses of the robot from two bearings and a distance.
Definition at line 536 of file GT2004SelfLocator.cpp. References Vector2< V >::abs(), pi, pi_2, Vector2< V >::x, and Vector2< V >::y. Referenced by generatePoseTemplates(). |
Here is the call graph for this function:
|
The function determines a pair of landmark positions and bearings from a landmarks percept.
Definition at line 576 of file GT2004SelfLocator.cpp. References Flag::angle, Goal::distance, Flag::distance, LandmarksPercept::goals, ConditionalBoundary::isOnBorder(), Goal::leftPost, Range< double >::max, Range< double >::min, numOfFlags, Flag::position, Goal::rightPost, and Boundary< double >::x. Referenced by generatePoseTemplates(). |
Here is the call graph for this function:
|
The function generates pose templates from a landmark percept. The pose templates can be used to initialize new samples.
Definition at line 630 of file GT2004SelfLocator.cpp. References Vector2< int >::abs(), Vector2< V >::abs(), addFlag(), Flag::angle, LandmarksPercept::cameraOffset, Flag::distance, LandmarksPercept::flags, getBearing(), getPlayer(), Player::getTeamColor(), nextTemplate, LandmarksPercept::numberOfFlags, LandmarksPercept::numberOfGoals, LinesPercept::numberOfPoints, numOfFlags, numOfTemplates, point, LinesPercept::points, poseFromBearings(), poseFromBearingsAndDistance(), randomFactor, TemplateTable< 50000 >::sample(), SAMPLES_MAX, templates, Vector2< int >::x, Vector3< double >::x, Vector2< V >::x, Vector2< int >::y, Vector3< double >::y, and Vector2< V >::y. Referenced by execute(). |
Here is the call graph for this function:
|
The function returns the next pose template or a random one if no templates were determined.
Definition at line 693 of file GT2004SelfLocator.cpp. References average, COMPLEX_DRAWING, draw(), Pose2D::getAngle(), Boundary< double >::isInside(), nextTemplate, numOfTemplates, Pose2D::random(), randomFactor, Field::randomPose(), templates, Pose2D::translation, Vector2< double >::x, and Vector2< double >::y. Referenced by resample(). |
Here is the call graph for this function:
|
The function draws an arrow to a debug drawing.
Definition at line 721 of file GT2004SelfLocator.cpp. References LINE, Pose2D::translation, Vector2< double >::x, and Vector2< double >::y. Referenced by getTemplate(), resample(), and updateByPoint(). |
|
The function draws a point of a line percept.
Definition at line 752 of file GT2004SelfLocator.cpp. References Geometry::calculatePointInImage(), CIRCLE, getRobotConfiguration(), point, Vector2< V >::x, and Vector2< V >::y. |
Here is the call graph for this function:
|
Here is the call graph for this function:
|
Called from a MessageQueue to distribute messages. Use message.getMessageID to decide if the message is relavant for the MesssageHandler derivate. Use message.bin, message.text or message.config as In streams to get the data from.
Reimplemented from Module. Definition at line 772 of file GT2004SelfLocator.cpp. References InMessage::bin, GenericDebugData::data, InMessage::getMessageID(), idLinesSelfLocatorParameters, paramDelay, paramDown, paramHeight, paramRot, paramTrans, paramUp, paramY, and paramZ. |
Here is the call graph for this function:
|
A class that can estimate the distance to the border.
Definition at line 25 of file GT2004SelfLocator.h. Referenced by execute(), and GT2004SelfLocator(). |
|
The sample set.
Definition at line 92 of file GT2004SelfLocator.h. Referenced by calcPose(), execute(), GT2004SelfLocator(), resample(), updateByFlag(), updateByGoalPost(), updateByOdometry(), and updateByPoint(). |
|
The state of the odometry at the previous call of this module.
Definition at line 93 of file GT2004SelfLocator.h. |
|
The state of the odometry at the previous call of this module.
Definition at line 93 of file GT2004SelfLocator.h. Referenced by execute(). |
|
Templates for poses replacing bad samples.
Definition at line 93 of file GT2004SelfLocator.h. Referenced by generatePoseTemplates(), and getTemplate(). |
|
A buffer for previously seen flags.
Definition at line 96 of file GT2004SelfLocator.h. |
|
The number of flags in the buffer.
Definition at line 97 of file GT2004SelfLocator.h. Referenced by addFlag(), generatePoseTemplates(), getBearing(), and GT2004SelfLocator(). |
|
The number of templates generated.
Definition at line 97 of file GT2004SelfLocator.h. Referenced by generatePoseTemplates(), getTemplate(), and resample(). |
|
The next template delivered.
Definition at line 97 of file GT2004SelfLocator.h. Referenced by generatePoseTemplates(), and getTemplate(). |
|
A factor that is increased if more templates are required.
Definition at line 100 of file GT2004SelfLocator.h. Referenced by generatePoseTemplates(), and getTemplate(). |
|
Definition at line 101 of file GT2004SelfLocator.h. |
|
Definition at line 102 of file GT2004SelfLocator.h. |
|
Did any update of the samples by a sensor reading happen?
Definition at line 103 of file GT2004SelfLocator.h. Referenced by execute(), GT2004SelfLocator(), updateByFlag(), and updateByGoalPost(). |
|
Definition at line 104 of file GT2004SelfLocator.h. Referenced by getTemplate(), GT2004SelfLocator(), and resample(). |
|
Definition at line 105 of file GT2004SelfLocator.h. |
|
Definition at line 106 of file GT2004SelfLocator.h. |
|
Initial value: 0.01 GT2004SelfLocator::paramDown = 0.005 GT2004SelfLocator::paramDelay = 3 GT2004SelfLocator::paramHeight = 150 GT2004SelfLocator::paramZ = 10 GT2004SelfLocator::paramY = 2 GT2004SelfLocator::paramR = 2 GT2004SelfLocator::paramTrans = 100 GT2004SelfLocator::paramRot = 0.5 Definition at line 20 of file GT2004SelfLocator.cpp. Referenced by handleMessage(). |
|
Definition at line 266 of file GT2004SelfLocator.h. Referenced by handleMessage(). |
|
Definition at line 266 of file GT2004SelfLocator.h. Referenced by handleMessage(). |
|
Definition at line 266 of file GT2004SelfLocator.h. Referenced by handleMessage(), and updateByPoint(). |
|
Definition at line 266 of file GT2004SelfLocator.h. Referenced by execute(), handleMessage(), and updateByPoint(). |
|
Definition at line 266 of file GT2004SelfLocator.h. Referenced by handleMessage(), and updateByPoint(). |
|
Definition at line 266 of file GT2004SelfLocator.h. |
|
Definition at line 266 of file GT2004SelfLocator.h. Referenced by execute(), and handleMessage(). |
|
Definition at line 266 of file GT2004SelfLocator.h. Referenced by handleMessage(). |