Skip to content

Commit 3552503

Browse files
committed
Remove wpilib.run for 2024
1 parent 6f6ff76 commit 3552503

File tree

62 files changed

+15
-258
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

62 files changed

+15
-258
lines changed

.github/workflows/test.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,8 @@ jobs:
3333
matrix:
3434
os: ["ubuntu-22.04", "macos-12", "windows-2022"]
3535
python_version:
36-
# - '3.8'
37-
# - '3.9'
36+
- '3.8'
37+
- '3.9'
3838
- '3.10'
3939
- '3.11'
4040
- '3.12'
@@ -48,7 +48,7 @@ jobs:
4848
- name: Install deps
4949
run: |
5050
pip install -U pip
51-
pip install 'robotpy[commands2]<2025.0.0,>=2024.0.0b3' numpy pytest
51+
pip install 'robotpy[commands2]<2025.0.0,>=2024.0.0b4.post1' numpy pytest
5252
- name: Run tests
5353
run: bash run_tests.sh
5454
shell: bash

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,9 @@ deploy.json
1010
.project
1111
.pydevproject
1212

13+
pyproject.toml
14+
wpilib_preferences.json
15+
1316
imgui.ini
1417
simgui*.json
1518

AddressableLED/robot.py

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,3 @@ def rainbow(self):
5252

5353
# Check bounds
5454
self.rainbowFirstPixelHue %= 180
55-
56-
57-
if __name__ == "__main__":
58-
wpilib.run(MyRobot)

ArcadeDrive/robot.py

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,3 @@ def teleopPeriodic(self):
3333
# That means that the Y axis drives forward
3434
# and backward, and the X turns left and right.
3535
self.robotDrive.arcadeDrive(self.stick.getY(), self.stick.getX())
36-
37-
38-
if __name__ == "__main__":
39-
wpilib.run(MyRobot)

ArcadeDriveXboxController/robot.py

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,3 @@ def teleopPeriodic(self):
3535
self.robotDrive.arcadeDrive(
3636
-self.driverController.getLeftY(), -self.driverController.getRightX()
3737
)
38-
39-
40-
if __name__ == "__main__":
41-
wpilib.run(MyRobot)

ArmBot/robot.py

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@
1414

1515
class MyRobot(commands2.TimedCommandRobot):
1616
"""
17-
Our default robot class, pass it to wpilib.run
1817
Command v2 robots are encouraged to inherit from TimedCommandRobot, which
1918
has an implementation of robotPeriodic which runs the scheduler for you
2019
"""
@@ -78,7 +77,3 @@ def teleopPeriodic(self) -> None:
7877
def testInit(self) -> None:
7978
# Cancels all running commands at the start of test mode
8079
commands2.CommandScheduler.getInstance().cancelAll()
81-
82-
83-
if __name__ == "__main__":
84-
wpilib.run(MyRobot)

ArmBotOffboard/robot.py

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@
1414

1515
class MyRobot(commands2.TimedCommandRobot):
1616
"""
17-
Our default robot class, pass it to wpilib.run
1817
Command v2 robots are encouraged to inherit from TimedCommandRobot, which
1918
has an implementation of robotPeriodic which runs the scheduler for you
2019
"""
@@ -65,7 +64,3 @@ def teleopPeriodic(self) -> None:
6564
def testInit(self) -> None:
6665
# Cancels all running commands at the start of test mode
6766
commands2.CommandScheduler.getInstance().cancelAll()
68-
69-
70-
if __name__ == "__main__":
71-
wpilib.run(MyRobot)

ArmSimulation/robot.py

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,3 @@ def teleopPeriodic(self):
3030
def disabledInit(self):
3131
# This just makes sure that our simulation code knows that the motor's off.
3232
self.arm.stop()
33-
34-
35-
if __name__ == "__main__":
36-
wpilib.run(MyRobot)

CANPDP/robot.py

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,3 @@ def robotPeriodic(self):
5353
# Energy is the power summed over time with units Joules.
5454
totalEnergy = self.pdp.getTotalEnergy()
5555
wpilib.SmartDashboard.putNumber("Total Energy", totalEnergy)
56-
57-
58-
if __name__ == "__main__":
59-
wpilib.run(MyRobot)

CONTRIBUTING.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,9 @@ Testing:
2626
General:
2727

2828
* We always try to stay as close to the original examples as possible
29-
* `Main.java` is never needed, it is equivalent to `wpilib.run(MyRobot)`
29+
* `Main.java` is never needed
3030
* `robot.py` should have `#!/usr/bin/env python3` as the very first line
31+
* This will go away soon as it is no longer needed in 2024
3132
* Note: Other files such as `vision.py` or `robotcontainer.py` should not start with `#!/usr/bin/env python3`
3233
* Don't ever check in files for your IDE (.vscode, .idea, etc)
3334
* Copy over the copyright statement from the original file

DifferentialDriveBot/robot.py

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,3 @@ def teleopPeriodic(self):
4343
)
4444

4545
self.drive.drive(xSpeed, rot)
46-
47-
48-
if __name__ == "__main__":
49-
wpilib.run(MyRobot)

DigitalCommunication/robot.py

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,3 @@ def robotPeriodic(self):
4646
# pull alert port high if match time remaining is between 30 and 25 seconds
4747
matchTime = wpilib.DriverStation.getMatchTime()
4848
self.alertOutput.set(30 >= matchTime >= 25)
49-
50-
51-
if __name__ == "__main__":
52-
wpilib.run(MyRobot)

DriveDistanceOffboard/robot.py

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@
2323

2424
class MyRobot(commands2.TimedCommandRobot):
2525
"""
26-
Our default robot class, pass it to wpilib.run
2726
Command v2 robots are encouraged to inherit from TimedCommandRobot, which
2827
has an implementation of robotPeriodic which runs the scheduler for you
2928
"""
@@ -72,7 +71,3 @@ def teleopPeriodic(self) -> None:
7271
def testInit(self) -> None:
7372
# Cancels all running commands at the start of test mode
7473
commands2.CommandScheduler.getInstance().cancelAll()
75-
76-
77-
if __name__ == "__main__":
78-
wpilib.run(MyRobot)

DutyCycleEncoder/robot.py

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,3 @@ def robotPeriodic(self):
3333
wpilib.SmartDashboard.putNumber("Frequency", frequency)
3434
wpilib.SmartDashboard.putNumber("Output", output)
3535
wpilib.SmartDashboard.putNumber("Distance", distance)
36-
37-
38-
if __name__ == "__main__":
39-
wpilib.run(MyRobot)

DutyCycleInput/robot.py

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,3 @@ def robotPeriodic(self):
2424

2525
wpilib.SmartDashboard.putNumber("Frequency", frequency)
2626
wpilib.SmartDashboard.putNumber("Duty Cycle", output)
27-
28-
29-
if __name__ == "__main__":
30-
wpilib.run(MyRobot)

ElevatorProfiledPID/robot.py

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,3 @@ def teleopPeriodic(self) -> None:
3636

3737
# Run controller and update motor output
3838
self.motor.set(self.controller.calculate(self.encoder.getDistance()))
39-
40-
41-
if __name__ == "__main__":
42-
wpilib.run(MyRobot)

ElevatorSimulation/robot.py

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,3 @@ def teleopPeriodic(self) -> None:
4949
def disabledInit(self) -> None:
5050
# This just makes sure that our simulation code knows that the motor is off
5151
self.motor.set(0)
52-
53-
54-
if __name__ == "__main__":
55-
wpilib.run(MyRobot)

ElevatorTrapezoidProfile/robot.py

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,3 @@ def teleopPeriodic(self):
5151
self.setpoint.position,
5252
self.feedforward.calculate(self.setpoint.velocity) / 12,
5353
)
54-
55-
56-
if __name__ == "__main__":
57-
wpilib.run(MyRobot)

Encoder/robot.py

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,3 @@ def robotInit(self):
5151
def teleopPeriodic(self):
5252
wpilib.SmartDashboard.putNumber("Encoder Distance", self.encoder.getDistance())
5353
wpilib.SmartDashboard.putNumber("Encoder Rate", self.encoder.getRate())
54-
55-
56-
if __name__ == "__main__":
57-
wpilib.run(MyRobot)

FlywheelBangBangController/robot.py

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,3 @@ def teleopPeriodic(self):
8383
self.flywheelMotor.setVoltage(
8484
bangOutput + 0.9 * self.feedforward.calculate(setpoint)
8585
)
86-
87-
88-
if __name__ == "__main__":
89-
wpilib.run(MyRobot)

FrisbeeBot/robot.py

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@
2323

2424
class MyRobot(commands2.TimedCommandRobot):
2525
"""
26-
Our default robot class, pass it to wpilib.run
2726
Command v2 robots are encouraged to inherit from TimedCommandRobot, which
2827
has an implementation of robotPeriodic which runs the scheduler for you
2928
"""
@@ -72,7 +71,3 @@ def teleopPeriodic(self) -> None:
7271
def testInit(self) -> None:
7372
# Cancels all running commands at the start of test mode
7473
commands2.CommandScheduler.getInstance().cancelAll()
75-
76-
77-
if __name__ == "__main__":
78-
wpilib.run(MyRobot)

GameData/robot.py

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,3 @@ def teleopPeriodic(self):
3939
self.red.set(self.gameData == "R")
4040
self.green.set(self.gameData == "G")
4141
self.yellow.set(self.gameData == "Y")
42-
43-
44-
if __name__ == "__main__":
45-
wpilib.run(MyRobot)

GettingStarted/robot.py

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,3 @@ def testInit(self):
5656

5757
def testPeriodic(self):
5858
"""This function is called periodically during test mode."""
59-
60-
61-
if __name__ == "__main__":
62-
wpilib.run(MyRobot)

Gyro/robot.py

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,3 @@ def teleopPeriodic(self):
4949
# from the error between the setpoint and the gyro angle.
5050
turningValue = (self.kAngleSetpoint - self.gyro.getAngle()) * self.kP
5151
self.myRobot.arcadeDrive(-self.joystick.getY(), -turningValue)
52-
53-
54-
if __name__ == "__main__":
55-
wpilib.run(MyRobot)

GyroDriveCommands/robot.py

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@
2323

2424
class MyRobot(commands2.TimedCommandRobot):
2525
"""
26-
Our default robot class, pass it to wpilib.run
2726
Command v2 robots are encouraged to inherit from TimedCommandRobot, which
2827
has an implementation of robotPeriodic which runs the scheduler for you
2928
"""
@@ -72,7 +71,3 @@ def teleopPeriodic(self) -> None:
7271
def testInit(self) -> None:
7372
# Cancels all running commands at the start of test mode
7473
commands2.CommandScheduler.getInstance().cancelAll()
75-
76-
77-
if __name__ == "__main__":
78-
wpilib.run(MyRobot)

GyroMecanum/robot.py

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,3 @@ def teleopPeriodic(self):
5454
-self.joystick.getZ(),
5555
self.gyro.getRotation2d(),
5656
)
57-
58-
59-
if __name__ == "__main__":
60-
wpilib.run(MyRobot)

HatchbotInlined/robot.py

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,6 @@
1414

1515
class MyRobot(commands2.TimedCommandRobot):
1616
"""
17-
Our default robot class, pass it to wpilib.run
18-
1917
Command v2 robots are encouraged to inherit from TimedCommandRobot, which
2018
has an implementation of robotPeriodic which runs the scheduler for you
2119
"""
@@ -62,7 +60,3 @@ def teleopPeriodic(self) -> None:
6260
def testInit(self) -> None:
6361
# Cancels all running commands at the start of test mode
6462
commands2.CommandScheduler.getInstance().cancelAll()
65-
66-
67-
if __name__ == "__main__":
68-
wpilib.run(MyRobot)

HatchbotTraditional/robot.py

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,6 @@
1414

1515
class MyRobot(commands2.TimedCommandRobot):
1616
"""
17-
Our default robot class, pass it to wpilib.run
18-
1917
Command v2 robots are encouraged to inherit from TimedCommandRobot, which
2018
has an implementation of robotPeriodic which runs the scheduler for you
2119
"""
@@ -62,7 +60,3 @@ def teleopPeriodic(self) -> None:
6260
def testInit(self) -> None:
6361
# Cancels all running commands at the start of test mode
6462
commands2.CommandScheduler.getInstance().cancelAll()
65-
66-
67-
if __name__ == "__main__":
68-
wpilib.run(MyRobot)

HidRumble/robot.py

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,3 @@ def disabledInit(self):
2727
# Stop the rumble when entering disabled
2828
self.hid.setRumble(wpilib.XboxController.RumbleType.kLeftRumble, 0.0)
2929
self.hid.setRumble(wpilib.XboxController.RumbleType.kRightRumble, 0.0)
30-
31-
32-
if __name__ == "__main__":
33-
wpilib.run(MyRobot)

I2CCommunication/robot.py

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,3 @@ def robotPeriodic(self):
5353
stateMessage = f"{allianceString}{enabledString}{autoString}{matchTime:03f}"
5454

5555
self.writeString(stateMessage)
56-
57-
58-
if __name__ == "__main__":
59-
wpilib.run(MyRobot)

IntermediateVision/robot.py

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,3 @@ class MyRobot(wpilib.TimedRobot):
1717

1818
def robotInit(self):
1919
wpilib.CameraServer.launch("vision.py:main")
20-
21-
22-
if __name__ == "__main__":
23-
wpilib.run(MyRobot)

MagicbotSimple/robot.py

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,3 @@ def teleopPeriodic(self):
4747
self.component2.do_something()
4848
except:
4949
self.onException()
50-
51-
52-
if __name__ == "__main__":
53-
wpilib.run(MyRobot)

MecanumBot/robot.py

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,3 @@ def _driveWithJoystick(self, fieldRelative: bool):
5555
)
5656

5757
self.mecanum.drive(xSpeed, ySpeed, rot, fieldRelative, self.getPeriod())
58-
59-
60-
if __name__ == "__main__":
61-
wpilib.run(MyRobot)

MecanumDrive/robot.py

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,3 @@ def teleopPeriodic(self):
4949
-self.stick.getX(),
5050
-self.stick.getZ(),
5151
)
52-
53-
54-
if __name__ == "__main__":
55-
wpilib.run(MyRobot)

MecanumDriveXbox/robot.py

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,3 @@ def teleopPeriodic(self):
6363
"""Alternatively, to match the driver station enumeration, you may use ---> self.drive.driveCartesian(
6464
self.stick.getRawAxis(1), self.stick.getRawAxis(3), self.stick.getRawAxis(2), 0
6565
)"""
66-
67-
68-
if __name__ == "__main__":
69-
wpilib.run(MyRobot)

Mechanism2d/robot.py

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,3 @@ def robotPeriodic(self):
5656
def teleopPeriodic(self):
5757
self.elevatorMotor.set(self.joystick.getRawAxis(0))
5858
self.wristMotor.set(self.joystick.getRawAxis(1))
59-
60-
61-
if __name__ == "__main__":
62-
wpilib.run(MyRobot)

MotorControl/robot.py

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,3 @@ def robotPeriodic(self):
4343

4444
def teleopPeriodic(self):
4545
self.motor.set(self.joystick.getY())
46-
47-
48-
if __name__ == "__main__":
49-
wpilib.run(MyRobot)

Physics/src/robot.py

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,3 @@ def teleopPeriodic(self):
6262
y = min(0, y)
6363

6464
self.motor.set(y)
65-
66-
67-
if __name__ == "__main__":
68-
wpilib.run(MyRobot)

Physics4Wheel/src/robot.py

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,3 @@ def autonomousPeriodic(self):
4646
def teleopPeriodic(self):
4747
"""Called when operation control mode is enabled"""
4848
self.drive.tankDrive(-self.lstick.getY(), -self.rstick.getY())
49-
50-
51-
if __name__ == "__main__":
52-
wpilib.run(MyRobot)

PhysicsCamSim/src/robot.py

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,3 @@ def teleopPeriodic(self):
116116
self.robot_drive.arcadeDrive(
117117
self.stick.getY() * -1, self.stick.getX(), squareInputs=True
118118
)
119-
120-
121-
if __name__ == "__main__":
122-
wpilib.run(MyRobot)

0 commit comments

Comments
 (0)