Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@ jobs:
matrix:
os: ["ubuntu-22.04", "macos-12", "windows-2022"]
python_version:
# - '3.8'
# - '3.9'
- '3.8'
- '3.9'
- '3.10'
- '3.11'
- '3.12'
Expand All @@ -48,7 +48,7 @@ jobs:
- name: Install deps
run: |
pip install -U pip
pip install 'robotpy[commands2]<2025.0.0,>=2024.0.0b3' numpy pytest
pip install 'robotpy[commands2]<2025.0.0,>=2024.0.0b4.post1' numpy pytest
- name: Run tests
run: bash run_tests.sh
shell: bash
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@ deploy.json
.project
.pydevproject

pyproject.toml
wpilib_preferences.json

imgui.ini
simgui*.json

Expand Down
4 changes: 0 additions & 4 deletions AddressableLED/robot.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,3 @@ def rainbow(self):

# Check bounds
self.rainbowFirstPixelHue %= 180


if __name__ == "__main__":
wpilib.run(MyRobot)
4 changes: 0 additions & 4 deletions ArcadeDrive/robot.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,3 @@ def teleopPeriodic(self):
# That means that the Y axis drives forward
# and backward, and the X turns left and right.
self.robotDrive.arcadeDrive(self.stick.getY(), self.stick.getX())


if __name__ == "__main__":
wpilib.run(MyRobot)
4 changes: 0 additions & 4 deletions ArcadeDriveXboxController/robot.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,3 @@ def teleopPeriodic(self):
self.robotDrive.arcadeDrive(
-self.driverController.getLeftY(), -self.driverController.getRightX()
)


if __name__ == "__main__":
wpilib.run(MyRobot)
5 changes: 0 additions & 5 deletions ArmBot/robot.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@

class MyRobot(commands2.TimedCommandRobot):
"""
Our default robot class, pass it to wpilib.run
Command v2 robots are encouraged to inherit from TimedCommandRobot, which
has an implementation of robotPeriodic which runs the scheduler for you
"""
Expand Down Expand Up @@ -78,7 +77,3 @@ def teleopPeriodic(self) -> None:
def testInit(self) -> None:
# Cancels all running commands at the start of test mode
commands2.CommandScheduler.getInstance().cancelAll()


if __name__ == "__main__":
wpilib.run(MyRobot)
5 changes: 0 additions & 5 deletions ArmBotOffboard/robot.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@

class MyRobot(commands2.TimedCommandRobot):
"""
Our default robot class, pass it to wpilib.run
Command v2 robots are encouraged to inherit from TimedCommandRobot, which
has an implementation of robotPeriodic which runs the scheduler for you
"""
Expand Down Expand Up @@ -65,7 +64,3 @@ def teleopPeriodic(self) -> None:
def testInit(self) -> None:
# Cancels all running commands at the start of test mode
commands2.CommandScheduler.getInstance().cancelAll()


if __name__ == "__main__":
wpilib.run(MyRobot)
4 changes: 0 additions & 4 deletions ArmSimulation/robot.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,3 @@ def teleopPeriodic(self):
def disabledInit(self):
# This just makes sure that our simulation code knows that the motor's off.
self.arm.stop()


if __name__ == "__main__":
wpilib.run(MyRobot)
4 changes: 0 additions & 4 deletions CANPDP/robot.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,3 @@ def robotPeriodic(self):
# Energy is the power summed over time with units Joules.
totalEnergy = self.pdp.getTotalEnergy()
wpilib.SmartDashboard.putNumber("Total Energy", totalEnergy)


if __name__ == "__main__":
wpilib.run(MyRobot)
3 changes: 2 additions & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,9 @@ Testing:
General:

* We always try to stay as close to the original examples as possible
* `Main.java` is never needed, it is equivalent to `wpilib.run(MyRobot)`
* `Main.java` is never needed
* `robot.py` should have `#!/usr/bin/env python3` as the very first line
* This will go away soon as it is no longer needed in 2024
* Note: Other files such as `vision.py` or `robotcontainer.py` should not start with `#!/usr/bin/env python3`
* Don't ever check in files for your IDE (.vscode, .idea, etc)
* Copy over the copyright statement from the original file
Expand Down
4 changes: 0 additions & 4 deletions DifferentialDriveBot/robot.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,3 @@ def teleopPeriodic(self):
)

self.drive.drive(xSpeed, rot)


if __name__ == "__main__":
wpilib.run(MyRobot)
4 changes: 0 additions & 4 deletions DigitalCommunication/robot.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,3 @@ def robotPeriodic(self):
# pull alert port high if match time remaining is between 30 and 25 seconds
matchTime = wpilib.DriverStation.getMatchTime()
self.alertOutput.set(30 >= matchTime >= 25)


if __name__ == "__main__":
wpilib.run(MyRobot)
5 changes: 0 additions & 5 deletions DriveDistanceOffboard/robot.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@

class MyRobot(commands2.TimedCommandRobot):
"""
Our default robot class, pass it to wpilib.run
Command v2 robots are encouraged to inherit from TimedCommandRobot, which
has an implementation of robotPeriodic which runs the scheduler for you
"""
Expand Down Expand Up @@ -72,7 +71,3 @@ def teleopPeriodic(self) -> None:
def testInit(self) -> None:
# Cancels all running commands at the start of test mode
commands2.CommandScheduler.getInstance().cancelAll()


if __name__ == "__main__":
wpilib.run(MyRobot)
4 changes: 0 additions & 4 deletions DutyCycleEncoder/robot.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,3 @@ def robotPeriodic(self):
wpilib.SmartDashboard.putNumber("Frequency", frequency)
wpilib.SmartDashboard.putNumber("Output", output)
wpilib.SmartDashboard.putNumber("Distance", distance)


if __name__ == "__main__":
wpilib.run(MyRobot)
4 changes: 0 additions & 4 deletions DutyCycleInput/robot.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,3 @@ def robotPeriodic(self):

wpilib.SmartDashboard.putNumber("Frequency", frequency)
wpilib.SmartDashboard.putNumber("Duty Cycle", output)


if __name__ == "__main__":
wpilib.run(MyRobot)
4 changes: 0 additions & 4 deletions ElevatorProfiledPID/robot.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,3 @@ def teleopPeriodic(self) -> None:

# Run controller and update motor output
self.motor.set(self.controller.calculate(self.encoder.getDistance()))


if __name__ == "__main__":
wpilib.run(MyRobot)
4 changes: 0 additions & 4 deletions ElevatorSimulation/robot.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,3 @@ def teleopPeriodic(self) -> None:
def disabledInit(self) -> None:
# This just makes sure that our simulation code knows that the motor is off
self.motor.set(0)


if __name__ == "__main__":
wpilib.run(MyRobot)
4 changes: 0 additions & 4 deletions ElevatorTrapezoidProfile/robot.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,3 @@ def teleopPeriodic(self):
self.setpoint.position,
self.feedforward.calculate(self.setpoint.velocity) / 12,
)


if __name__ == "__main__":
wpilib.run(MyRobot)
4 changes: 0 additions & 4 deletions Encoder/robot.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,3 @@ def robotInit(self):
def teleopPeriodic(self):
wpilib.SmartDashboard.putNumber("Encoder Distance", self.encoder.getDistance())
wpilib.SmartDashboard.putNumber("Encoder Rate", self.encoder.getRate())


if __name__ == "__main__":
wpilib.run(MyRobot)
4 changes: 0 additions & 4 deletions FlywheelBangBangController/robot.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,3 @@ def teleopPeriodic(self):
self.flywheelMotor.setVoltage(
bangOutput + 0.9 * self.feedforward.calculate(setpoint)
)


if __name__ == "__main__":
wpilib.run(MyRobot)
5 changes: 0 additions & 5 deletions FrisbeeBot/robot.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@

class MyRobot(commands2.TimedCommandRobot):
"""
Our default robot class, pass it to wpilib.run
Command v2 robots are encouraged to inherit from TimedCommandRobot, which
has an implementation of robotPeriodic which runs the scheduler for you
"""
Expand Down Expand Up @@ -72,7 +71,3 @@ def teleopPeriodic(self) -> None:
def testInit(self) -> None:
# Cancels all running commands at the start of test mode
commands2.CommandScheduler.getInstance().cancelAll()


if __name__ == "__main__":
wpilib.run(MyRobot)
4 changes: 0 additions & 4 deletions GameData/robot.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,3 @@ def teleopPeriodic(self):
self.red.set(self.gameData == "R")
self.green.set(self.gameData == "G")
self.yellow.set(self.gameData == "Y")


if __name__ == "__main__":
wpilib.run(MyRobot)
4 changes: 0 additions & 4 deletions GettingStarted/robot.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,3 @@ def testInit(self):

def testPeriodic(self):
"""This function is called periodically during test mode."""


if __name__ == "__main__":
wpilib.run(MyRobot)
4 changes: 0 additions & 4 deletions Gyro/robot.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,3 @@ def teleopPeriodic(self):
# from the error between the setpoint and the gyro angle.
turningValue = (self.kAngleSetpoint - self.gyro.getAngle()) * self.kP
self.myRobot.arcadeDrive(-self.joystick.getY(), -turningValue)


if __name__ == "__main__":
wpilib.run(MyRobot)
5 changes: 0 additions & 5 deletions GyroDriveCommands/robot.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@

class MyRobot(commands2.TimedCommandRobot):
"""
Our default robot class, pass it to wpilib.run
Command v2 robots are encouraged to inherit from TimedCommandRobot, which
has an implementation of robotPeriodic which runs the scheduler for you
"""
Expand Down Expand Up @@ -72,7 +71,3 @@ def teleopPeriodic(self) -> None:
def testInit(self) -> None:
# Cancels all running commands at the start of test mode
commands2.CommandScheduler.getInstance().cancelAll()


if __name__ == "__main__":
wpilib.run(MyRobot)
4 changes: 0 additions & 4 deletions GyroMecanum/robot.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,3 @@ def teleopPeriodic(self):
-self.joystick.getZ(),
self.gyro.getRotation2d(),
)


if __name__ == "__main__":
wpilib.run(MyRobot)
6 changes: 0 additions & 6 deletions HatchbotInlined/robot.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,6 @@

class MyRobot(commands2.TimedCommandRobot):
"""
Our default robot class, pass it to wpilib.run

Command v2 robots are encouraged to inherit from TimedCommandRobot, which
has an implementation of robotPeriodic which runs the scheduler for you
"""
Expand Down Expand Up @@ -62,7 +60,3 @@ def teleopPeriodic(self) -> None:
def testInit(self) -> None:
# Cancels all running commands at the start of test mode
commands2.CommandScheduler.getInstance().cancelAll()


if __name__ == "__main__":
wpilib.run(MyRobot)
6 changes: 0 additions & 6 deletions HatchbotTraditional/robot.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,6 @@

class MyRobot(commands2.TimedCommandRobot):
"""
Our default robot class, pass it to wpilib.run

Command v2 robots are encouraged to inherit from TimedCommandRobot, which
has an implementation of robotPeriodic which runs the scheduler for you
"""
Expand Down Expand Up @@ -62,7 +60,3 @@ def teleopPeriodic(self) -> None:
def testInit(self) -> None:
# Cancels all running commands at the start of test mode
commands2.CommandScheduler.getInstance().cancelAll()


if __name__ == "__main__":
wpilib.run(MyRobot)
4 changes: 0 additions & 4 deletions HidRumble/robot.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,3 @@ def disabledInit(self):
# Stop the rumble when entering disabled
self.hid.setRumble(wpilib.XboxController.RumbleType.kLeftRumble, 0.0)
self.hid.setRumble(wpilib.XboxController.RumbleType.kRightRumble, 0.0)


if __name__ == "__main__":
wpilib.run(MyRobot)
4 changes: 0 additions & 4 deletions I2CCommunication/robot.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,3 @@ def robotPeriodic(self):
stateMessage = f"{allianceString}{enabledString}{autoString}{matchTime:03f}"

self.writeString(stateMessage)


if __name__ == "__main__":
wpilib.run(MyRobot)
4 changes: 0 additions & 4 deletions IntermediateVision/robot.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,3 @@ class MyRobot(wpilib.TimedRobot):

def robotInit(self):
wpilib.CameraServer.launch("vision.py:main")


if __name__ == "__main__":
wpilib.run(MyRobot)
4 changes: 0 additions & 4 deletions MagicbotSimple/robot.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,3 @@ def teleopPeriodic(self):
self.component2.do_something()
except:
self.onException()


if __name__ == "__main__":
wpilib.run(MyRobot)
4 changes: 0 additions & 4 deletions MecanumBot/robot.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,3 @@ def _driveWithJoystick(self, fieldRelative: bool):
)

self.mecanum.drive(xSpeed, ySpeed, rot, fieldRelative, self.getPeriod())


if __name__ == "__main__":
wpilib.run(MyRobot)
4 changes: 0 additions & 4 deletions MecanumDrive/robot.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,3 @@ def teleopPeriodic(self):
-self.stick.getX(),
-self.stick.getZ(),
)


if __name__ == "__main__":
wpilib.run(MyRobot)
4 changes: 0 additions & 4 deletions MecanumDriveXbox/robot.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,3 @@ def teleopPeriodic(self):
"""Alternatively, to match the driver station enumeration, you may use ---> self.drive.driveCartesian(
self.stick.getRawAxis(1), self.stick.getRawAxis(3), self.stick.getRawAxis(2), 0
)"""


if __name__ == "__main__":
wpilib.run(MyRobot)
4 changes: 0 additions & 4 deletions Mechanism2d/robot.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,3 @@ def robotPeriodic(self):
def teleopPeriodic(self):
self.elevatorMotor.set(self.joystick.getRawAxis(0))
self.wristMotor.set(self.joystick.getRawAxis(1))


if __name__ == "__main__":
wpilib.run(MyRobot)
4 changes: 0 additions & 4 deletions MotorControl/robot.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,3 @@ def robotPeriodic(self):

def teleopPeriodic(self):
self.motor.set(self.joystick.getY())


if __name__ == "__main__":
wpilib.run(MyRobot)
4 changes: 0 additions & 4 deletions Physics/src/robot.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,3 @@ def teleopPeriodic(self):
y = min(0, y)

self.motor.set(y)


if __name__ == "__main__":
wpilib.run(MyRobot)
4 changes: 0 additions & 4 deletions Physics4Wheel/src/robot.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,3 @@ def autonomousPeriodic(self):
def teleopPeriodic(self):
"""Called when operation control mode is enabled"""
self.drive.tankDrive(-self.lstick.getY(), -self.rstick.getY())


if __name__ == "__main__":
wpilib.run(MyRobot)
4 changes: 0 additions & 4 deletions PhysicsCamSim/src/robot.py
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,3 @@ def teleopPeriodic(self):
self.robot_drive.arcadeDrive(
self.stick.getY() * -1, self.stick.getX(), squareInputs=True
)


if __name__ == "__main__":
wpilib.run(MyRobot)
Loading