forked from kozzza/FRC7447-Innovation-Challenge-2021
-
Notifications
You must be signed in to change notification settings - Fork 0
/
final_robot.pseudo
44 lines (35 loc) · 1.23 KB
/
final_robot.pseudo
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
from drivebase import move
from touch_sensors import right_send_signal, left_send_signal
from rolling_pin import turnClockwise
from weight_sensors import weight_send_signal
function on_start() do //THIS FUNCTION WILL RUN ONE TIME WHEN THE ROBOT TURNS ON
//Assuming the robot starts in an orientation parallel to the court perimeter
set base_move_speed = 0.5
set slow_move_speed = 0.25
set fast_move_speed = 0.75
set backward_move_speed = -0.25
end
function check_and_turn() do
if(right_send_signal()):
move(backward_move_speed, backward_move_speed)
move(slow_move_speed, base_move_speed)
return true
else if(left_send_signal()):
move(backward_move_speed, backward_move_speed)
move(base_move_speed, slow_move_speed)
return true
return false
end
function on_run() do //THIS FUNCTION RUNS CONTINOUSLY ONCE THE ROBOT IS TURNED ON
turnClockwise(base_move_speed)
if weight_send_signal():
on_end()
if check_and_turn()
move(slow_move_speed, slow_move_speed)
else
move(fast_move_speed, fast_move_speed)
end
function on_end() do //THIS FUNCTION WILL RUN ONE TIME WHEN THE ROBOT TURNS OFF
move(0, 0)
turnClockwise(0)
end