Skip to content

Commit 1fe04b3

Browse files
committed
wip
1 parent ea86e7a commit 1fe04b3

27 files changed

+2853
-3424
lines changed

external_samples/color_range_sensor.py

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -49,12 +49,6 @@ def get_url(self) -> str:
4949
def get_version(self) -> tuple[int, int, int]:
5050
return (1, 0, 0)
5151

52-
def reset(self) -> None:
53-
pass
54-
55-
def periodic(self) -> None:
56-
pass
57-
5852
# Component specific methods
5953

6054
def get_color_rgb(self) -> tuple[int, int, int]:

external_samples/component.py

Lines changed: 0 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -65,30 +65,8 @@ def get_url(self) -> str:
6565
def get_version(self) -> tuple[int, int, int]:
6666
pass
6767

68-
def start(self) -> None:
69-
pass
70-
71-
def update(self) -> None:
72-
pass
73-
74-
# This stops all movement (if any) for the component
75-
def stop(self) -> None:
76-
pass
77-
78-
# This performs any reset required (if any) at the beginning of each opmode
79-
# This might remove any registered callbacks
80-
@abstractmethod
81-
def reset(self) -> None:
82-
pass
83-
8468
# Returns the port this connects to of the PortType enumeration
8569
def get_connection_port_type(self) -> PortType | None:
8670
if self.port:
8771
return self.port.get_type()
8872
return None
89-
90-
# This is called periodically when an opmode is running. The component might use this
91-
# to talk to hardware and then call callbacks
92-
@abstractmethod
93-
def periodic(self) -> None:
94-
pass

external_samples/expansion_hub_motor.py

Lines changed: 1 addition & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
from typing import Self
2424
from component import Component, InvalidPortException
2525
from port import Port, PortType
26-
import expansion_hub
26+
from wpilib_placeholders import expansion_hub
2727
import wpimath
2828

2929
class ExpansionHubMotor(Component):
@@ -46,21 +46,6 @@ def get_url(self) -> str:
4646
def get_version(self) -> tuple[int, int, int]:
4747
return (1, 0, 0)
4848

49-
def start(self) -> None:
50-
self.expansion_hub_motor.setEnabled(True)
51-
52-
def stop(self) -> None:
53-
# TODO: Send stop command to motor.
54-
pass
55-
56-
def reset(self) -> None:
57-
pass
58-
59-
def periodic(self) -> None:
60-
pass
61-
62-
# Component specific methods
63-
6449
# Methods from expansion_hub.ExpansionHubMotor
6550

6651
def setPercentagePower(self, power: float):

external_samples/expansion_hub_servo.py

Lines changed: 4 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,10 @@
2121
__author__ = "lizlooney@google.com (Liz Looney)"
2222

2323
from typing import Self
24-
from component import Component, PortType, InvalidPortException
24+
from component import Component, InvalidPortException
2525
from port import Port, PortType
26-
import expansion_hub
26+
from wpilib_placeholders import expansion_hub
27+
import wpimath
2728

2829
class ExpansionHubServo(Component):
2930
def __init__(self, port : Port):
@@ -45,25 +46,6 @@ def get_url(self) -> str:
4546
def get_version(self) -> tuple[int, int, int]:
4647
return (1, 0, 0)
4748

48-
def start(self) -> None:
49-
self.expansion_hub_servo.setEnabled(True)
50-
pass
51-
52-
def stop(self) -> None:
53-
# TODO: Send stop command to servo.
54-
pass
55-
56-
def reset(self) -> None:
57-
pass
58-
59-
def get_connection_port_type(self) -> list[PortType]:
60-
return [PortType.USB_PORT, PortType.USB_PORT]
61-
62-
def periodic(self) -> None:
63-
pass
64-
65-
# Component specific methods
66-
6749
# Methods from expansion_hub.ExpansionHubServo
6850

6951
def set(self, value: float):
@@ -78,7 +60,7 @@ def setEnabled(self, enabled: bool):
7860
def isHubConnected(self) -> bool:
7961
return self.expansion_hub_servo.isHubConnected()
8062

81-
def setFramePeriod(self, framePeriod: int):
63+
def setFramePeriod(self, framePeriod: wpimath.units.microseconds):
8264
self.expansion_hub_servo.setFramePeriod(framePeriod)
8365

8466
def setPulseWidth(self, pulseWidth: int):

external_samples/smart_motor.py

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -39,16 +39,6 @@ def get_url(self) -> str:
3939
def get_version(self) -> tuple[int, int, int]:
4040
return (1, 0, 0)
4141

42-
def stop(self) -> None:
43-
# TODO: send stop command to motor
44-
pass
45-
46-
def reset(self) -> None:
47-
pass
48-
49-
def periodic(self) -> None:
50-
pass
51-
5242
# Component specific methods
5343

5444
def set_speed(self, speed: float) -> None:

external_samples/spark_mini.py

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -51,18 +51,6 @@ def get_url(self) -> str:
5151
def get_version(self) -> tuple[int, int, int]:
5252
return (1, 0, 0)
5353

54-
def stop(self) -> None:
55-
# TODO: send stop command to motor
56-
pass
57-
58-
def reset(self) -> None:
59-
pass
60-
61-
def periodic(self) -> None:
62-
pass
63-
64-
# Component specific methods
65-
6654
# Methods from wpilib.PWMMotorController
6755

6856
def add_follower(self, follower: wpilib.PWMMotorController) -> None:

external_samples/sparkfun_led_stick.py

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -38,15 +38,6 @@ def get_url(self) -> str:
3838
def get_version(self) -> tuple[int, int, int]:
3939
return (1, 0, 0)
4040

41-
def stop(self) -> None:
42-
self.turn_all_off()
43-
44-
def reset(self) -> None:
45-
pass
46-
47-
def periodic(self) -> None:
48-
pass
49-
5041
# SparkFunLEDStick methods
5142

5243
def set_color(self, position: int, color: wpilib.Color) -> None:
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
"""Placeholder classes for future wpilib."""
2+
3+
from .expansion_hub import ExpansionHubPidConstants, ExpansionHubMotor, ExpansionHubServo, ExpansionHub
4+
from .op_mode_robot import OpModeRobot
5+
from .periodic_op_mode import PeriodicOpMode
6+
7+
__all__ = [
8+
'ExpansionHubPidConstants',
9+
'ExpansionHubMotor',
10+
'ExpansionHubServo',
11+
'ExpansionHub',
12+
'OpModeRobot',
13+
'PeriodicOpMode',
14+
]
File renamed without changes.
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
import wpilib
2+
3+
class OpModeRobot:
4+
def __init__(self):
5+
pass
6+
7+
def StartCompetition(self):
8+
pass
9+
10+
def EndCompetition(self):
11+
pass
12+
13+
def DriverStationConnected(self):
14+
pass
15+
16+
def NonePeriodic(self):
17+
pass
18+
19+
def AddOpMode(self, mode, name: str, group: str, description: str, textColor: wpilib.Color, backgroundColor: wpilib.Color):
20+
pass
21+
22+
def AddOpMode(self, mode, name: str, group: str, description: str):
23+
pass

0 commit comments

Comments
 (0)