aboutsummaryrefslogtreecommitdiff
path: root/robot/mode_maze.c
diff options
context:
space:
mode:
authorlonkaars <loek@pipeframe.xyz>2022-06-08 14:56:00 +0200
committerlonkaars <loek@pipeframe.xyz>2022-06-08 14:56:00 +0200
commit867a54109c1bf25617fa46fd4c776db10d56fa8d (patch)
tree69e487f68821bf9e64b421e5369c450394bd04a6 /robot/mode_maze.c
parent92a43e07b10903d5f1a572ebdf9a40571b75e73d (diff)
`make format`0.6.0
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;