#include <GT2004RobotStateDetector.h>
Inheritance diagram for GT2004RobotStateDetector:
Public Member Functions | |
GT2004RobotStateDetector (const RobotStateDetectorInterfaces &interfaces) | |
virtual void | execute () |
Private Types | |
middle = 0 | |
left | |
right | |
robotSides | |
maxFrameHistory = 200 | |
enum | { middle = 0, left, right, robotSides } |
enum | { maxFrameHistory = 200 } |
Private Member Functions | |
void | calculateCollisionState () |
void | setNewButtonStatus () |
int | getCollisionSide () |
void | setCollisionOnLeftSide (bool collision) |
void | setCollisionOnRightSide (bool collision) |
Private Attributes | |
bool | switchDown [BodyPercept::numOfSwitches] |
long | switchDownTime [BodyPercept::numOfSwitches] |
long | timeSinceLastCollision [6] |
long | consecutiveCollisionTime [6] |
long | remindCollision |
bool | numOfCollisions [maxFrameHistory][robotSides] |
bool | buttonPressed [BodyPercept::numOfSwitches] |
long | buttonTime [BodyPercept::numOfSwitches] |
long | buttonPressedTime [BodyPercept::numOfSwitches] |
long | buttonDuration [BodyPercept::numOfSwitches] |
bool | anyBackButtonPressed |
long | anyBackButtonTime |
long | anyBackButtonPressedTime |
long | anyBackButtonDuration |
Definition at line 23 of file GT2004RobotStateDetector.h.
anonymous enum [private] |
anonymous enum [private] |
GT2004RobotStateDetector::GT2004RobotStateDetector | ( | const RobotStateDetectorInterfaces & | interfaces | ) |
Constructor.
interfaces | The paramters of the RobotStateDetector module. |
Definition at line 12 of file GT2004RobotStateDetector.cpp.
References anyBackButtonDuration, anyBackButtonPressed, anyBackButtonPressedTime, anyBackButtonTime, buttonDuration, buttonPressed, buttonPressedTime, buttonTime, consecutiveCollisionTime, maxFrameHistory, numOfCollisions, BodyPercept::numOfSwitches, remindCollision, robotSides, setNewButtonStatus(), switchDown, and timeSinceLastCollision.
void GT2004RobotStateDetector::calculateCollisionState | ( | ) | [private] |
Definition at line 169 of file GT2004RobotStateDetector.cpp.
References RobotStateDetectorInterfaces::collisionPercept, consecutiveCollisionTime, CollisionPercept::getCollisionAggregate(), CollisionPercept::getCollisionFrontLeft(), CollisionPercept::getCollisionFrontRight(), CollisionPercept::getCollisionHead(), CollisionPercept::getCollisionHindLeft(), CollisionPercept::getCollisionHindRight(), getCollisionSide(), SystemCall::getCurrentSystemTime(), remindCollision, RobotStateDetectorInterfaces::robotState, RobotState::setCollisionAggregate(), RobotState::setCollisionFrontLeft(), RobotState::setCollisionFrontRight(), RobotState::setCollisionHead(), RobotState::setCollisionHindLeft(), RobotState::setCollisionHindRight(), setCollisionOnLeftSide(), setCollisionOnRightSide(), RobotState::setCollisionSide(), RobotState::setConsecutiveCollisionTimeAggregate(), RobotState::setConsecutiveCollisionTimeFrontLeft(), RobotState::setConsecutiveCollisionTimeFrontRight(), RobotState::setConsecutiveCollisionTimeHead(), RobotState::setConsecutiveCollisionTimeHindLeft(), RobotState::setConsecutiveCollisionTimeHindRight(), and timeSinceLastCollision.
Referenced by execute().
void GT2004RobotStateDetector::execute | ( | ) | [virtual] |
Executes the module
Implements Module.
Definition at line 51 of file GT2004RobotStateDetector.cpp.
References BodyPercept::acceleration, RobotState::acceleration, anyBackButtonDuration, anyBackButtonPressed, anyBackButtonPressedTime, anyBackButtonTime, BodyPercept::backBack, BodyPercept::backFront, BodyPercept::backMiddle, RobotStateDetectorInterfaces::bodyPercept, buttonDuration, buttonPressed, buttonPressedTime, buttonTime, calculateCollisionState(), BodyPercept::frameNumber, BodyPercept::getBodyPSDDistance(), BodyPercept::getBodyPSDHighValue(), SystemCall::getCurrentSystemTime(), BodyPercept::getMouthState(), BodyPercept::getState(), BodyPercept::getSwitches(), SystemCall::getTimeSince(), BodyPercept::numOfSwitches, RobotStateDetectorInterfaces::robotState, RobotState::setDistanceToSIFOC(), RobotState::setFrameNumber(), RobotState::setMouthState(), setNewButtonStatus(), RobotState::setSomethingInFrontOfChest(), RobotState::setState(), RobotState::setTimeWhenSomethingWasInFrontOfChestLast(), switchDown, and switchDownTime.
int GT2004RobotStateDetector::getCollisionSide | ( | ) | [private] |
Did collision occur at front left leg
Definition at line 311 of file GT2004RobotStateDetector.cpp.
References left, maxFrameHistory, middle, numOfCollisions, and right.
Referenced by calculateCollisionState().
void GT2004RobotStateDetector::setCollisionOnLeftSide | ( | bool | collision | ) | [private] |
Definition at line 327 of file GT2004RobotStateDetector.cpp.
References RobotStateDetectorInterfaces::collisionPercept, CollisionPercept::frameNumber, left, maxFrameHistory, and numOfCollisions.
Referenced by calculateCollisionState().
void GT2004RobotStateDetector::setCollisionOnRightSide | ( | bool | collision | ) | [private] |
Definition at line 332 of file GT2004RobotStateDetector.cpp.
References RobotStateDetectorInterfaces::collisionPercept, CollisionPercept::frameNumber, maxFrameHistory, numOfCollisions, and right.
Referenced by calculateCollisionState().
void GT2004RobotStateDetector::setNewButtonStatus | ( | ) | [private] |
Definition at line 157 of file GT2004RobotStateDetector.cpp.
References anyBackButtonDuration, anyBackButtonPressed, anyBackButtonPressedTime, anyBackButtonTime, buttonDuration, buttonPressed, buttonPressedTime, buttonTime, RobotStateDetectorInterfaces::robotState, RobotState::setAnyBackButtonDuration(), RobotState::setAnyBackButtonPressed(), RobotState::setAnyBackButtonPressedTime(), RobotState::setAnyBackButtonTime(), RobotState::setButtonDuration(), RobotState::setButtonPressed(), RobotState::setButtonPressedTime(), and RobotState::setButtonTime().
Referenced by execute(), and GT2004RobotStateDetector().
long GT2004RobotStateDetector::anyBackButtonDuration [private] |
Definition at line 68 of file GT2004RobotStateDetector.h.
Referenced by execute(), GT2004RobotStateDetector(), and setNewButtonStatus().
bool GT2004RobotStateDetector::anyBackButtonPressed [private] |
Definition at line 65 of file GT2004RobotStateDetector.h.
Referenced by execute(), GT2004RobotStateDetector(), and setNewButtonStatus().
long GT2004RobotStateDetector::anyBackButtonPressedTime [private] |
Definition at line 67 of file GT2004RobotStateDetector.h.
Referenced by execute(), GT2004RobotStateDetector(), and setNewButtonStatus().
long GT2004RobotStateDetector::anyBackButtonTime [private] |
Definition at line 66 of file GT2004RobotStateDetector.h.
Referenced by execute(), GT2004RobotStateDetector(), and setNewButtonStatus().
long GT2004RobotStateDetector::buttonDuration[BodyPercept::numOfSwitches] [private] |
Definition at line 64 of file GT2004RobotStateDetector.h.
Referenced by execute(), GT2004RobotStateDetector(), and setNewButtonStatus().
bool GT2004RobotStateDetector::buttonPressed[BodyPercept::numOfSwitches] [private] |
Definition at line 61 of file GT2004RobotStateDetector.h.
Referenced by execute(), GT2004RobotStateDetector(), and setNewButtonStatus().
long GT2004RobotStateDetector::buttonPressedTime[BodyPercept::numOfSwitches] [private] |
Definition at line 63 of file GT2004RobotStateDetector.h.
Referenced by execute(), GT2004RobotStateDetector(), and setNewButtonStatus().
long GT2004RobotStateDetector::buttonTime[BodyPercept::numOfSwitches] [private] |
Definition at line 62 of file GT2004RobotStateDetector.h.
Referenced by execute(), GT2004RobotStateDetector(), and setNewButtonStatus().
long GT2004RobotStateDetector::consecutiveCollisionTime[6] [private] |
Definition at line 44 of file GT2004RobotStateDetector.h.
Referenced by calculateCollisionState(), and GT2004RobotStateDetector().
bool GT2004RobotStateDetector::numOfCollisions[maxFrameHistory][robotSides] [private] |
Definition at line 57 of file GT2004RobotStateDetector.h.
Referenced by getCollisionSide(), GT2004RobotStateDetector(), setCollisionOnLeftSide(), and setCollisionOnRightSide().
long GT2004RobotStateDetector::remindCollision [private] |
Definition at line 45 of file GT2004RobotStateDetector.h.
Referenced by calculateCollisionState(), and GT2004RobotStateDetector().
bool GT2004RobotStateDetector::switchDown[BodyPercept::numOfSwitches] [private] |
Definition at line 41 of file GT2004RobotStateDetector.h.
Referenced by execute(), and GT2004RobotStateDetector().
long GT2004RobotStateDetector::switchDownTime[BodyPercept::numOfSwitches] [private] |
long GT2004RobotStateDetector::timeSinceLastCollision[6] [private] |
Definition at line 43 of file GT2004RobotStateDetector.h.
Referenced by calculateCollisionState(), and GT2004RobotStateDetector().