summaryrefslogtreecommitdiff
path: root/robot/mode_maze.c
diff options
context:
space:
mode:
Diffstat (limited to 'robot/mode_maze.c')
-rw-r--r--robot/mode_maze.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/robot/mode_maze.c b/robot/mode_maze.c
index da3fa2a..eb75e3c 100644
--- a/robot/mode_maze.c
+++ b/robot/mode_maze.c
@@ -1,19 +1,19 @@
#include "mode_maze.h"
-#include "orangutan_shim.h"
-#include "movement.h"
#include "mode_grid.h"
+#include "movement.h"
+#include "orangutan_shim.h"
unsigned int g_w2_last_proportional = 0;
long g_w2_integral = 0;
void w2_mode_maze() {
// PID controller
- g_w2_position = read_line(g_w2_sensors, IR_EMITTERS_ON);
+ g_w2_position = read_line(g_w2_sensors, IR_EMITTERS_ON);
int proportional = ((int)g_w2_position) - 2000;
- int derivative = proportional - g_w2_last_proportional;
+ int derivative = proportional - g_w2_last_proportional;
g_w2_integral += proportional;
g_w2_last_proportional = proportional;
- int power_difference = proportional / 20 + g_w2_integral / 10000 + derivative * 3 / 2;
+ int power_difference = proportional / 20 + g_w2_integral / 10000 + derivative * 3 / 2;
const int max = 60;
if (power_difference > max) power_difference = max;