summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFrank v/d Haterd <f.h.a.v.d.haterd@student.tue.nl>2013-12-22 15:34:26 +0100
committerFrank v/d Haterd <f.h.a.v.d.haterd@student.tue.nl>2013-12-22 15:34:26 +0100
commit043b180cdcd033725c48a9fb5a0829236044da07 (patch)
treefe7871fcca0b7ff8775fdea609bd6140d715f30e
parentf61e0a2840b6dfd737e84fd327ad3b16fd6d59f4 (diff)
download2iv60-robots-043b180cdcd033725c48a9fb5a0829236044da07.tar.gz
Robot rotation (I think?) fixed
-rw-r--r--src/RobotRace.java12
1 files changed, 10 insertions, 2 deletions
diff --git a/src/RobotRace.java b/src/RobotRace.java
index 05789e2..bcfceab 100644
--- a/src/RobotRace.java
+++ b/src/RobotRace.java
@@ -378,6 +378,11 @@ public class RobotRace extends Base {
// to 0 means robot is matching expected and great means that
// we have a turtle.
double jitter = current_t - robot.getTimePos();
+
+
+
+
+
// TODO: do not use static speed
robot.setSpeed(TARGET_ROBOT_SPEED);
}
@@ -408,8 +413,11 @@ public class RobotRace extends Base {
// put robot centered on the lane, slightly rotated to look forward
Vector robotPos = raceTrack.getPointForLane(robot.getTimePos(), i);
gl.glTranslated(robotPos.x(), robotPos.y(), robotPos.z());
- // FIXME: robot looks in wrong direction.
- double angle = atan2(robotPos.y(), robotPos.x());
+
+ // Calculate angle for the robots to look at, multiply by 180/PI
+ // to convert the radions to degrees.
+ double angle = atan2(robotPos.y(), robotPos.x()) * 180/PI;
+
gl.glRotated(angle, 0, 0, 1);
// Draw the current robot