Skip to content

Commit 3120b88

Browse files
committed
Update base classes
1 parent 5864803 commit 3120b88

File tree

4 files changed

+38
-9
lines changed

4 files changed

+38
-9
lines changed
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
# This is the class all mechanisms derive from
2+
3+
class Mechanism:
4+
def __init__(self):
5+
self.hardware = []
6+
def start(self):
7+
for hardware in self.hardware:
8+
hardware.start()
9+
def update(self):
10+
for hardware in self.hardware:
11+
hardware.update()
12+
def stop(self):
13+
for hardware in self.hardware:
14+
hardware.stop()
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
# This is the base class that all OpModes derive from
2+
class OpMode:
3+
def __init__(self, robot):
4+
self.robot = robot
5+
def start(self):
6+
self.robot.start()
7+
def loop(self):
8+
self.robot.update()
9+
def stop(self):
10+
self.robot.stop()
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
# This is the class all robots derive from
2+
3+
class RobotBase:
4+
def __init__(self):
5+
self.hardware = []
6+
def start(self):
7+
for hardware in self.hardware:
8+
hardware.start()
9+
def update(self):
10+
for hardware in self.hardware:
11+
hardware.update()
12+
def stop(self):
13+
for hardware in self.hardware:
14+
hardware.stop()

server_python_scripts/opmode.py

Lines changed: 0 additions & 9 deletions
This file was deleted.

0 commit comments

Comments
 (0)