summaryrefslogtreecommitdiffstats
path: root/source/Concept/Framework/modules/interpreter/position_tracker.c
diff options
context:
space:
mode:
Diffstat (limited to 'source/Concept/Framework/modules/interpreter/position_tracker.c')
-rwxr-xr-xsource/Concept/Framework/modules/interpreter/position_tracker.c21
1 files changed, 12 insertions, 9 deletions
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);*/
}