-
Notifications
You must be signed in to change notification settings - Fork 187
/
which_half.py
50 lines (43 loc) · 1.86 KB
/
which_half.py
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
45
46
47
48
49
50
import robocup
import constants
import play
import enum
import behavior
import main
# Slides and other materials can be found here:
# https://github.com/RoboJackets/robocup-training
#
# Field Documentation can be found here:
# https://robojackets.github.io/robocup-software/struct_field___dimensions.html
#
# Ball Documentation can be found here:
# https://robojackets.github.io/robocup-software/class_ball.html
# Maintains the state of the ball's position by keeping track of which
# half the ball is on and prints on both entering a given state and
# continously during the execution of a given state.
class WhichHalf(play.Play):
class State(enum.Enum):
# Define your states here.
# eg: some_state = 0
# -----------------------
pass # remove this once you have put in your states
def __init__(self):
super().__init__(continuous=True)
# Register the states you defined using 'add_state'.
# eg: self.add_state(WhichHalf.State.<???>,
# behavior.Behavior.State.running)
# ----------------------------------------------------
# Add your state transitions using 'add_transition'.
# eg: self.add_transition(behavior.Behavior.State.start,
# self.State.<???>, lambda: True,
# 'immediately')
# eg: self.add_transition(self.State.<???>, self.State.<???>,
# lambda: <???>,
# 'state change message')
# ------------------------------------------------------------
# Define your own 'on_enter' and 'execute' functions here.
# eg: def on_enter_<???>(self):
# print('Something?')
# eg: def execute_<???>(self):
# print('Something?')
# ---------------------------------------------------------