summaryrefslogtreecommitdiffstats
path: root/source/Concept/Framework/modules/interpreter
diff options
context:
space:
mode:
authorsicarius <devnull@localhost>2007-02-22 21:59:02 +0100
committersicarius <devnull@localhost>2007-02-22 21:59:02 +0100
commitf544ab78229d3a4d54b910135ba61bb816009589 (patch)
tree6b1d9aad746299631a0b67661c2d2be62b5e7525 /source/Concept/Framework/modules/interpreter
parentdc8b1cde313f3f8a60462187bbeeea4277fd0313 (diff)
downloadrc2007-soccer-f544ab78229d3a4d54b910135ba61bb816009589.tar
rc2007-soccer-f544ab78229d3a4d54b910135ba61bb816009589.zip
The Last Day ?
Diffstat (limited to 'source/Concept/Framework/modules/interpreter')
-rwxr-xr-xsource/Concept/Framework/modules/interpreter/ball_tracker.c15
-rwxr-xr-xsource/Concept/Framework/modules/interpreter/ball_tracker.h10
-rwxr-xr-xsource/Concept/Framework/modules/interpreter/position_tracker.c21
-rwxr-xr-xsource/Concept/Framework/modules/interpreter/position_tracker.h4
4 files changed, 37 insertions, 13 deletions
diff --git a/source/Concept/Framework/modules/interpreter/ball_tracker.c b/source/Concept/Framework/modules/interpreter/ball_tracker.c
index 2d85b96..16fdfb4 100755
--- a/source/Concept/Framework/modules/interpreter/ball_tracker.c
+++ b/source/Concept/Framework/modules/interpreter/ball_tracker.c
@@ -21,6 +21,21 @@ void Ball_Tracker::Update()
{
greatestIntensity = i;
}
+
+ if(i == 0)
+ {
+ if(intensity[i] > BALL_HELD_INTENSITY) // Ball derzeit sehr nah dran
+ {
+ ballHeld = true;
+ ballHeldCounter = 100;
+ }
+ else if(ballHeldCounter > 0) // Oder vor kurzem erst sehr nah dran
+ {
+ ballHeld = true;
+ ballHeldCounter--;
+ }
+ else ballHeld = false; // ansonsten hat er den Ball nicht
+ }
}
if(intensity[greatestIntensity])
diff --git a/source/Concept/Framework/modules/interpreter/ball_tracker.h b/source/Concept/Framework/modules/interpreter/ball_tracker.h
index c62f05e..cb90ff2 100755
--- a/source/Concept/Framework/modules/interpreter/ball_tracker.h
+++ b/source/Concept/Framework/modules/interpreter/ball_tracker.h
@@ -11,6 +11,8 @@ public:
this->parent = NULL;
this->moduleId = 0;
this->direction = EMPTY_FLOAT;
+ this->ballHeldCounter = 0;
+ this->ballHeld = false;
}
Ball_Tracker(uint32 trackerId)
@@ -18,10 +20,14 @@ public:
this->parent = NULL;
this->moduleId = trackerId;
this->direction = EMPTY_FLOAT;
+ this->ballHeldCounter = 0;
+ this->ballHeld = false;
}
protected:
float direction;
+ uint8 ballHeldCounter;
+ bool ballHeld;
public:
void Update();
@@ -33,12 +39,12 @@ public:
bool KnowsBallDirection()
{
- return direction != EMPTY_FLOAT;
+ return (direction != EMPTY_FLOAT);
}
bool RobotHasBall()
{
- //fill me!
+ return ballHeld;
}
};
diff --git a/source/Concept/Framework/modules/interpreter/position_tracker.c b/source/Concept/Framework/modules/interpreter/position_tracker.c
index a64ab60..f6d67ac 100755
--- a/source/Concept/Framework/modules/interpreter/position_tracker.c
+++ b/source/Concept/Framework/modules/interpreter/position_tracker.c
@@ -10,6 +10,10 @@ void Position_Tracker::Update()
// Generate a vector for the left mouse
int8 leftX = mouseLeft->GetXMovement();
int8 leftY = mouseLeft->GetYMovement();
+ // Generate a vector for the right mouse
+ int8 rightX = mouseRight->GetXMovement();
+ int8 rightY = mouseRight->GetYMovement();
+
float distanceLeft = sqrt(leftX * leftX + leftY * leftY);
float angleLeft = easyAngle(atan2(leftY, leftX) + (225.0f * PI / 180.0f));
@@ -23,9 +27,6 @@ void Position_Tracker::Update()
movementLeftY = 0;
}
- // Generate a vector for the right mouse
- int8 rightX = mouseRight->GetXMovement();
- int8 rightY = mouseRight->GetYMovement();
float distanceRight = sqrt(rightX * rightX + rightY * rightY);
float angleRight = easyAngle(atan2(rightY, rightX) - (45.0f * PI / 180.0f));
@@ -50,13 +51,9 @@ void Position_Tracker::Update()
float robotMovementY = movementDifferenceY / 2.0f;
robotMovementX += movementLeftX + mouseLeft->GetPositionX() + (-mouseLeft->GetPositionX() * cos(orientationDiff));
robotMovementY += movementLeftY + mouseLeft->GetPositionY() + (mouseLeft->GetPositionX() * sin(orientationDiff));
- //float robotDistance = sqrt(robotMovementX * robotMovementX + robotMovementY * robotMovementY);
-
- float absoluteDiffX = cos(this->orientation + (orientationDiff / 2.0f)) * robotMovementX - sin(this->orientation + (orientationDiff / 2.0f)) * robotMovementY;
- float absoluteDiffY = sin(this->orientation + (orientationDiff / 2.0f) + PI / 2.0f) * robotMovementY + cos(this->orientation + (orientationDiff / 2.0f) - PI / 2.0f) * robotMovementX;
- //float absoluteDiffX = cos(this->orientation + (orientationDiff / 2.0f)) * robotDistance * sign(robotMovementX);
- //float absoluteDiffY = sin(this->orientation + (orientationDiff / 2.0f)) * robotDistance * sign(robotMovementY);
+ float absoluteDiffX = cos(this->orientation + (orientationDiff / 2.0f)) * robotMovementX + sin(this->orientation + (orientationDiff / 2.0f)) * robotMovementY;
+ float absoluteDiffY = sin(this->orientation + (orientationDiff / 2.0f) + PI / 2.0f) * robotMovementY - cos(this->orientation + (orientationDiff / 2.0f) - PI / 2.0f) * robotMovementX;
if(!robotMovementX && !robotMovementY)
{
@@ -74,4 +71,10 @@ void Position_Tracker::Update()
this->orientation += orientationDiff;
this->orientation = easyAngle(this->orientation);
+
+ //(parent->GetModule<Display>(IO_DISPLAY_MAIN))->Print(" ", 5, 1);
+ /*(parent->GetModule<Display>(IO_DISPLAY_MAIN))->Clear();
+ (parent->GetModule<Display>(IO_DISPLAY_MAIN))->Print(this->orientation * 180.0f / PI, 5, 1);
+ (parent->GetModule<Display>(IO_DISPLAY_MAIN))->Print(this->positionX, 1, 2);
+ (parent->GetModule<Display>(IO_DISPLAY_MAIN))->Print(this->positionY, 1, 3);*/
}
diff --git a/source/Concept/Framework/modules/interpreter/position_tracker.h b/source/Concept/Framework/modules/interpreter/position_tracker.h
index 47d0740..56b16c4 100755
--- a/source/Concept/Framework/modules/interpreter/position_tracker.h
+++ b/source/Concept/Framework/modules/interpreter/position_tracker.h
@@ -51,8 +51,8 @@ public:
// returns orientation
float GetOrientation() {
- return 0.0f; //tmp!!!!!!!!!!
- //return orientation;
+ //return 0.0f; //tmp!!!!!!!!!!
+ return orientation;
}
};