summaryrefslogtreecommitdiff
path: root/robot/mode_maze.c
diff options
context:
space:
mode:
authorlonkaars <loek@pipeframe.xyz>2022-06-24 11:42:23 +0200
committerlonkaars <loek@pipeframe.xyz>2022-06-24 11:42:23 +0200
commit40f6164ba6187a0160af9fe200bbd1d729e8c03b (patch)
tree84246633f40cb0c5d858168f63a5933d18006db3 /robot/mode_maze.c
parent2e537232404bf5123bc92e7218156ec03160c68f (diff)
added TARQ to robot and client
Diffstat (limited to 'robot/mode_maze.c')
-rw-r--r--robot/mode_maze.c17
1 files changed, 7 insertions, 10 deletions
diff --git a/robot/mode_maze.c b/robot/mode_maze.c
index 0350205..72478e8 100644
--- a/robot/mode_maze.c
+++ b/robot/mode_maze.c
@@ -6,8 +6,7 @@
unsigned int g_w2_last_proportional = 0;
long g_w2_integral = 0;
-
-//main function for maze mode
+// main function for maze mode
void w2_mode_maze() {
// PID controller
g_w2_position = read_line(g_w2_sensors, IR_EMITTERS_ON);
@@ -22,17 +21,15 @@ void w2_mode_maze() {
if (power_difference < -max) power_difference = -max;
if (g_w2_sensors[0] < 100 && g_w2_sensors[1] < 100 && g_w2_sensors[2] < 100 &&
- g_w2_sensors[3] < 100 && g_w2_sensors[4] < 100) { //dead ends
+ g_w2_sensors[3] < 100 && g_w2_sensors[4] < 100) { // dead ends
w2_crosswalk_stroll();
- }
- else if (g_w2_sensors[0] >= 500 && g_w2_sensors[1] >= 250 && g_w2_sensors[2] >= 500 &&
- g_w2_sensors[3] >= 250 && g_w2_sensors[4] >= 500) { //crossways or intersection
+ } else if (g_w2_sensors[0] >= 500 && g_w2_sensors[1] >= 250 && g_w2_sensors[2] >= 500 &&
+ g_w2_sensors[3] >= 250 && g_w2_sensors[4] >= 500) { // crossways or intersection
w2_maze_rotation_half_left();
- }
- else if (g_w2_sensors[0] >= 500 && g_w2_sensors[1] >= 200 && g_w2_sensors[4] < 100) { //left corners
+ } else if (g_w2_sensors[0] >= 500 && g_w2_sensors[1] >= 200 &&
+ g_w2_sensors[4] < 100) { // left corners
w2_maze_rotation_half_left();
- }
- else { //normal line following
+ } else { // normal line following
if (power_difference < 0 &&
(g_w2_sensors[2] > 100 || g_w2_sensors[3] > 100 || g_w2_sensors[1] > 100))
set_motors(max + power_difference, max);