From 3552503755e9324982fb40982c0d9599ed042daf Mon Sep 17 00:00:00 2001 From: Dustin Spicuzza Date: Sat, 6 Jan 2024 04:03:24 -0500 Subject: [PATCH] Remove wpilib.run for 2024 --- .github/workflows/test.yml | 6 +++--- .gitignore | 3 +++ AddressableLED/robot.py | 4 ---- ArcadeDrive/robot.py | 4 ---- ArcadeDriveXboxController/robot.py | 4 ---- ArmBot/robot.py | 5 ----- ArmBotOffboard/robot.py | 5 ----- ArmSimulation/robot.py | 4 ---- CANPDP/robot.py | 4 ---- CONTRIBUTING.md | 3 ++- DifferentialDriveBot/robot.py | 4 ---- DigitalCommunication/robot.py | 4 ---- DriveDistanceOffboard/robot.py | 5 ----- DutyCycleEncoder/robot.py | 4 ---- DutyCycleInput/robot.py | 4 ---- ElevatorProfiledPID/robot.py | 4 ---- ElevatorSimulation/robot.py | 4 ---- ElevatorTrapezoidProfile/robot.py | 4 ---- Encoder/robot.py | 4 ---- FlywheelBangBangController/robot.py | 4 ---- FrisbeeBot/robot.py | 5 ----- GameData/robot.py | 4 ---- GettingStarted/robot.py | 4 ---- Gyro/robot.py | 4 ---- GyroDriveCommands/robot.py | 5 ----- GyroMecanum/robot.py | 4 ---- HatchbotInlined/robot.py | 6 ------ HatchbotTraditional/robot.py | 6 ------ HidRumble/robot.py | 4 ---- I2CCommunication/robot.py | 4 ---- IntermediateVision/robot.py | 4 ---- MagicbotSimple/robot.py | 4 ---- MecanumBot/robot.py | 4 ---- MecanumDrive/robot.py | 4 ---- MecanumDriveXbox/robot.py | 4 ---- Mechanism2d/robot.py | 4 ---- MotorControl/robot.py | 4 ---- Physics/src/robot.py | 4 ---- Physics4Wheel/src/robot.py | 4 ---- PhysicsCamSim/src/robot.py | 4 ---- PhysicsMecanum/src/robot.py | 4 ---- PhysicsSPI/src/robot.py | 4 ---- PotentiometerPID/robot.py | 4 ---- QuickVision/robot.py | 4 ---- RamseteCommand/robot.py | 6 ------ RamseteController/robot.py | 4 ---- Relay/robot.py | 4 ---- RomiReference/robot.py | 18 ++++++------------ SchedulerEventLogging/robot.py | 5 ----- SelectCommand/robot.py | 5 ----- ShuffleBoard/robot.py | 4 ---- Solenoid/robot.py | 4 ---- StateSpaceFlywheel/robot.py | 4 ---- StateSpaceFlywheelSysId/robot.py | 4 ---- StatefulAutonomous/robot.py | 4 ---- SwerveBot/robot.py | 4 ---- TankDrive/robot.py | 4 ---- TankDriveXboxController/robot.py | 4 ---- Timed/src/robot.py | 4 ---- Ultrasonic/robot.py | 4 ---- UltrasonicPID/robot.py | 4 ---- run_tests.sh | 2 +- 62 files changed, 15 insertions(+), 258 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 1c9800b..adaa23f 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -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' @@ -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 diff --git a/.gitignore b/.gitignore index 574cd39..cb80cf5 100644 --- a/.gitignore +++ b/.gitignore @@ -10,6 +10,9 @@ deploy.json .project .pydevproject +pyproject.toml +wpilib_preferences.json + imgui.ini simgui*.json diff --git a/AddressableLED/robot.py b/AddressableLED/robot.py index 1576680..ddd88cd 100644 --- a/AddressableLED/robot.py +++ b/AddressableLED/robot.py @@ -52,7 +52,3 @@ def rainbow(self): # Check bounds self.rainbowFirstPixelHue %= 180 - - -if __name__ == "__main__": - wpilib.run(MyRobot) diff --git a/ArcadeDrive/robot.py b/ArcadeDrive/robot.py index b9faf3b..7a05e96 100755 --- a/ArcadeDrive/robot.py +++ b/ArcadeDrive/robot.py @@ -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) diff --git a/ArcadeDriveXboxController/robot.py b/ArcadeDriveXboxController/robot.py index 56664ca..7d5df6b 100755 --- a/ArcadeDriveXboxController/robot.py +++ b/ArcadeDriveXboxController/robot.py @@ -35,7 +35,3 @@ def teleopPeriodic(self): self.robotDrive.arcadeDrive( -self.driverController.getLeftY(), -self.driverController.getRightX() ) - - -if __name__ == "__main__": - wpilib.run(MyRobot) diff --git a/ArmBot/robot.py b/ArmBot/robot.py index d3f2cc2..15a6629 100644 --- a/ArmBot/robot.py +++ b/ArmBot/robot.py @@ -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 """ @@ -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) diff --git a/ArmBotOffboard/robot.py b/ArmBotOffboard/robot.py index d7f6ae0..c3ecb43 100644 --- a/ArmBotOffboard/robot.py +++ b/ArmBotOffboard/robot.py @@ -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 """ @@ -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) diff --git a/ArmSimulation/robot.py b/ArmSimulation/robot.py index 1a59dfa..5a4043e 100755 --- a/ArmSimulation/robot.py +++ b/ArmSimulation/robot.py @@ -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) diff --git a/CANPDP/robot.py b/CANPDP/robot.py index 0c98d55..157fc3f 100755 --- a/CANPDP/robot.py +++ b/CANPDP/robot.py @@ -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) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index d9e7c05..9cb119f 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -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 diff --git a/DifferentialDriveBot/robot.py b/DifferentialDriveBot/robot.py index 553c9f8..5adf34c 100755 --- a/DifferentialDriveBot/robot.py +++ b/DifferentialDriveBot/robot.py @@ -43,7 +43,3 @@ def teleopPeriodic(self): ) self.drive.drive(xSpeed, rot) - - -if __name__ == "__main__": - wpilib.run(MyRobot) diff --git a/DigitalCommunication/robot.py b/DigitalCommunication/robot.py index 8e2d50f..4145575 100755 --- a/DigitalCommunication/robot.py +++ b/DigitalCommunication/robot.py @@ -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) diff --git a/DriveDistanceOffboard/robot.py b/DriveDistanceOffboard/robot.py index 0b7561a..e845be0 100644 --- a/DriveDistanceOffboard/robot.py +++ b/DriveDistanceOffboard/robot.py @@ -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 """ @@ -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) diff --git a/DutyCycleEncoder/robot.py b/DutyCycleEncoder/robot.py index 8837dc7..9415f72 100755 --- a/DutyCycleEncoder/robot.py +++ b/DutyCycleEncoder/robot.py @@ -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) diff --git a/DutyCycleInput/robot.py b/DutyCycleInput/robot.py index 91ea2bf..523d51e 100755 --- a/DutyCycleInput/robot.py +++ b/DutyCycleInput/robot.py @@ -24,7 +24,3 @@ def robotPeriodic(self): wpilib.SmartDashboard.putNumber("Frequency", frequency) wpilib.SmartDashboard.putNumber("Duty Cycle", output) - - -if __name__ == "__main__": - wpilib.run(MyRobot) diff --git a/ElevatorProfiledPID/robot.py b/ElevatorProfiledPID/robot.py index 2bbe997..1703797 100644 --- a/ElevatorProfiledPID/robot.py +++ b/ElevatorProfiledPID/robot.py @@ -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) diff --git a/ElevatorSimulation/robot.py b/ElevatorSimulation/robot.py index aa131a5..7cdf616 100755 --- a/ElevatorSimulation/robot.py +++ b/ElevatorSimulation/robot.py @@ -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) diff --git a/ElevatorTrapezoidProfile/robot.py b/ElevatorTrapezoidProfile/robot.py index ec9baaa..c6a5d6a 100644 --- a/ElevatorTrapezoidProfile/robot.py +++ b/ElevatorTrapezoidProfile/robot.py @@ -51,7 +51,3 @@ def teleopPeriodic(self): self.setpoint.position, self.feedforward.calculate(self.setpoint.velocity) / 12, ) - - -if __name__ == "__main__": - wpilib.run(MyRobot) diff --git a/Encoder/robot.py b/Encoder/robot.py index 75e1705..fabab02 100755 --- a/Encoder/robot.py +++ b/Encoder/robot.py @@ -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) diff --git a/FlywheelBangBangController/robot.py b/FlywheelBangBangController/robot.py index c00bca1..467b3ea 100755 --- a/FlywheelBangBangController/robot.py +++ b/FlywheelBangBangController/robot.py @@ -83,7 +83,3 @@ def teleopPeriodic(self): self.flywheelMotor.setVoltage( bangOutput + 0.9 * self.feedforward.calculate(setpoint) ) - - -if __name__ == "__main__": - wpilib.run(MyRobot) diff --git a/FrisbeeBot/robot.py b/FrisbeeBot/robot.py index 0b7561a..e845be0 100644 --- a/FrisbeeBot/robot.py +++ b/FrisbeeBot/robot.py @@ -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 """ @@ -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) diff --git a/GameData/robot.py b/GameData/robot.py index c11a5a9..02e857a 100755 --- a/GameData/robot.py +++ b/GameData/robot.py @@ -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) diff --git a/GettingStarted/robot.py b/GettingStarted/robot.py index 7d01f48..06ce466 100755 --- a/GettingStarted/robot.py +++ b/GettingStarted/robot.py @@ -56,7 +56,3 @@ def testInit(self): def testPeriodic(self): """This function is called periodically during test mode.""" - - -if __name__ == "__main__": - wpilib.run(MyRobot) diff --git a/Gyro/robot.py b/Gyro/robot.py index 2ffd769..5c7949a 100755 --- a/Gyro/robot.py +++ b/Gyro/robot.py @@ -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) diff --git a/GyroDriveCommands/robot.py b/GyroDriveCommands/robot.py index 0b7561a..e845be0 100644 --- a/GyroDriveCommands/robot.py +++ b/GyroDriveCommands/robot.py @@ -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 """ @@ -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) diff --git a/GyroMecanum/robot.py b/GyroMecanum/robot.py index faeb16b..1a05084 100755 --- a/GyroMecanum/robot.py +++ b/GyroMecanum/robot.py @@ -54,7 +54,3 @@ def teleopPeriodic(self): -self.joystick.getZ(), self.gyro.getRotation2d(), ) - - -if __name__ == "__main__": - wpilib.run(MyRobot) diff --git a/HatchbotInlined/robot.py b/HatchbotInlined/robot.py index 92a7d81..0a85fca 100644 --- a/HatchbotInlined/robot.py +++ b/HatchbotInlined/robot.py @@ -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 """ @@ -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) diff --git a/HatchbotTraditional/robot.py b/HatchbotTraditional/robot.py index 92a7d81..0a85fca 100644 --- a/HatchbotTraditional/robot.py +++ b/HatchbotTraditional/robot.py @@ -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 """ @@ -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) diff --git a/HidRumble/robot.py b/HidRumble/robot.py index 1357a11..f08872e 100755 --- a/HidRumble/robot.py +++ b/HidRumble/robot.py @@ -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) diff --git a/I2CCommunication/robot.py b/I2CCommunication/robot.py index f19e79a..a955f2e 100755 --- a/I2CCommunication/robot.py +++ b/I2CCommunication/robot.py @@ -53,7 +53,3 @@ def robotPeriodic(self): stateMessage = f"{allianceString}{enabledString}{autoString}{matchTime:03f}" self.writeString(stateMessage) - - -if __name__ == "__main__": - wpilib.run(MyRobot) diff --git a/IntermediateVision/robot.py b/IntermediateVision/robot.py index f13feaa..5401ead 100755 --- a/IntermediateVision/robot.py +++ b/IntermediateVision/robot.py @@ -17,7 +17,3 @@ class MyRobot(wpilib.TimedRobot): def robotInit(self): wpilib.CameraServer.launch("vision.py:main") - - -if __name__ == "__main__": - wpilib.run(MyRobot) diff --git a/MagicbotSimple/robot.py b/MagicbotSimple/robot.py index 8d5ff9e..753e0c8 100755 --- a/MagicbotSimple/robot.py +++ b/MagicbotSimple/robot.py @@ -47,7 +47,3 @@ def teleopPeriodic(self): self.component2.do_something() except: self.onException() - - -if __name__ == "__main__": - wpilib.run(MyRobot) diff --git a/MecanumBot/robot.py b/MecanumBot/robot.py index 1bb7b83..584814f 100755 --- a/MecanumBot/robot.py +++ b/MecanumBot/robot.py @@ -55,7 +55,3 @@ def _driveWithJoystick(self, fieldRelative: bool): ) self.mecanum.drive(xSpeed, ySpeed, rot, fieldRelative, self.getPeriod()) - - -if __name__ == "__main__": - wpilib.run(MyRobot) diff --git a/MecanumDrive/robot.py b/MecanumDrive/robot.py index e586b8e..90552da 100755 --- a/MecanumDrive/robot.py +++ b/MecanumDrive/robot.py @@ -49,7 +49,3 @@ def teleopPeriodic(self): -self.stick.getX(), -self.stick.getZ(), ) - - -if __name__ == "__main__": - wpilib.run(MyRobot) diff --git a/MecanumDriveXbox/robot.py b/MecanumDriveXbox/robot.py index 9444822..7d8ca9d 100755 --- a/MecanumDriveXbox/robot.py +++ b/MecanumDriveXbox/robot.py @@ -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) diff --git a/Mechanism2d/robot.py b/Mechanism2d/robot.py index a074c1c..c6f9974 100755 --- a/Mechanism2d/robot.py +++ b/Mechanism2d/robot.py @@ -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) diff --git a/MotorControl/robot.py b/MotorControl/robot.py index 90de1c5..b1b137b 100755 --- a/MotorControl/robot.py +++ b/MotorControl/robot.py @@ -43,7 +43,3 @@ def robotPeriodic(self): def teleopPeriodic(self): self.motor.set(self.joystick.getY()) - - -if __name__ == "__main__": - wpilib.run(MyRobot) diff --git a/Physics/src/robot.py b/Physics/src/robot.py index b26f1af..822d496 100755 --- a/Physics/src/robot.py +++ b/Physics/src/robot.py @@ -62,7 +62,3 @@ def teleopPeriodic(self): y = min(0, y) self.motor.set(y) - - -if __name__ == "__main__": - wpilib.run(MyRobot) diff --git a/Physics4Wheel/src/robot.py b/Physics4Wheel/src/robot.py index e30ca78..f13fce0 100755 --- a/Physics4Wheel/src/robot.py +++ b/Physics4Wheel/src/robot.py @@ -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) diff --git a/PhysicsCamSim/src/robot.py b/PhysicsCamSim/src/robot.py index e5d324d..0a6d24d 100755 --- a/PhysicsCamSim/src/robot.py +++ b/PhysicsCamSim/src/robot.py @@ -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) diff --git a/PhysicsMecanum/src/robot.py b/PhysicsMecanum/src/robot.py index 5d094cc..2658caf 100755 --- a/PhysicsMecanum/src/robot.py +++ b/PhysicsMecanum/src/robot.py @@ -68,7 +68,3 @@ def teleopPeriodic(self): self.drive.driveCartesian( self.lstick.getX(), -self.lstick.getY(), self.lstick.getRawAxis(2) ) - - -if __name__ == "__main__": - wpilib.run(MyRobot) diff --git a/PhysicsSPI/src/robot.py b/PhysicsSPI/src/robot.py index f2ef440..881ad99 100755 --- a/PhysicsSPI/src/robot.py +++ b/PhysicsSPI/src/robot.py @@ -62,7 +62,3 @@ def teleopPeriodic(self): y = min(0, y) self.motor.set(y) - - -if __name__ == "__main__": - wpilib.run(MyRobot) diff --git a/PotentiometerPID/robot.py b/PotentiometerPID/robot.py index 9295fd7..36c8090 100644 --- a/PotentiometerPID/robot.py +++ b/PotentiometerPID/robot.py @@ -62,7 +62,3 @@ def teleopPeriodic(self): self.index = (self.index + 1) % len(self.kSetpointMeters) print(f"m_index = {self.index}") self.pidController.setSetpoint(self.kSetpointMeters[self.index]) - - -if __name__ == "__main__": - wpilib.run(MyRobot) diff --git a/QuickVision/robot.py b/QuickVision/robot.py index 159bfc9..5446199 100644 --- a/QuickVision/robot.py +++ b/QuickVision/robot.py @@ -18,7 +18,3 @@ class MyRobot(wpilib.TimedRobot): def robotInit(self): CameraServer().launch() - - -if __name__ == "__main__": - wpilib.run(MyRobot) diff --git a/RamseteCommand/robot.py b/RamseteCommand/robot.py index 4cbe47a..96b01dd 100644 --- a/RamseteCommand/robot.py +++ b/RamseteCommand/robot.py @@ -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 """ @@ -66,7 +64,3 @@ def testInit(self) -> None: def testPeriodic(self) -> None: """This function is called periodically during test mode""" - - -if __name__ == "__main__": - wpilib.run(MyRobot) diff --git a/RamseteController/robot.py b/RamseteController/robot.py index 77ea9f2..6653f26 100644 --- a/RamseteController/robot.py +++ b/RamseteController/robot.py @@ -99,7 +99,3 @@ def teleopPeriodic(self): ) self.drive.drive(xSpeed, rot) - - -if __name__ == "__main__": - wpilib.run(MyRobot) diff --git a/Relay/robot.py b/Relay/robot.py index 5475cfd..b2ff7cb 100644 --- a/Relay/robot.py +++ b/Relay/robot.py @@ -48,7 +48,3 @@ def teleopPeriodic(self): self.relay.set(wpilib.Relay.Value.kReverse) else: self.relay.set(wpilib.Relay.Value.kOff) - - -if __name__ == "__main__": - wpilib.run(MyRobot) diff --git a/RomiReference/robot.py b/RomiReference/robot.py index 8ca1340..0cfc34e 100644 --- a/RomiReference/robot.py +++ b/RomiReference/robot.py @@ -25,10 +25,10 @@ # To run the program you will need to explicitly use the ws-client option: # # # Windows -# py -3 robot.py sim --ws-client +# py -3 robotpy sim --ws-client # # # Linux/macOS -# python robot.py sim --ws-client +# python robotpy sim --ws-client # # By default the WPILib simulation GUI will be displayed. To disable the display # you can add the --nogui option @@ -42,11 +42,13 @@ from robotcontainer import RobotContainer +# If your ROMI isn't at the default address, set that here +os.environ["HALSIMWS_HOST"] = "10.0.0.2" +os.environ["HALSIMWS_PORT"] = "3300" + 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 """ @@ -93,11 +95,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__": - # If your ROMI isn't at the default address, set that here - os.environ["HALSIMWS_HOST"] = "10.0.0.2" - os.environ["HALSIMWS_PORT"] = "3300" - - wpilib.run(MyRobot) diff --git a/SchedulerEventLogging/robot.py b/SchedulerEventLogging/robot.py index d7f6ae0..c3ecb43 100644 --- a/SchedulerEventLogging/robot.py +++ b/SchedulerEventLogging/robot.py @@ -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 """ @@ -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) diff --git a/SelectCommand/robot.py b/SelectCommand/robot.py index d7f6ae0..c3ecb43 100644 --- a/SelectCommand/robot.py +++ b/SelectCommand/robot.py @@ -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 """ @@ -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) diff --git a/ShuffleBoard/robot.py b/ShuffleBoard/robot.py index ba99225..e890588 100755 --- a/ShuffleBoard/robot.py +++ b/ShuffleBoard/robot.py @@ -69,7 +69,3 @@ def robotInit(self): def autonomousInit(self): # Read the value of the 'max speed' widget from the dashboard self.robotDrive.setMaxOutput(self.maxSpeed.getDouble(1.0)) - - -if __name__ == "__main__": - wpilib.run(MyRobot) diff --git a/Solenoid/robot.py b/Solenoid/robot.py index 5757a33..988e037 100644 --- a/Solenoid/robot.py +++ b/Solenoid/robot.py @@ -108,7 +108,3 @@ def teleopPeriodic(self): # that the system is not full. # Hybrid mode exists only on the PH! On the PCM, this enables digital control. self.compressor.enableHybrid(70, 120) - - -if __name__ == "__main__": - wpilib.run(MyRobot) diff --git a/StateSpaceFlywheel/robot.py b/StateSpaceFlywheel/robot.py index 80b9ad6..b5ca017 100644 --- a/StateSpaceFlywheel/robot.py +++ b/StateSpaceFlywheel/robot.py @@ -114,7 +114,3 @@ def teleopPeriodic(self) -> None: # duty cycle = voltage / battery voltage nextVoltage = self.loop.U() self.motor.setVoltage(nextVoltage) - - -if __name__ == "__main__": - wpilib.run(MyRobot) diff --git a/StateSpaceFlywheelSysId/robot.py b/StateSpaceFlywheelSysId/robot.py index 1183ee2..c6aeeed 100644 --- a/StateSpaceFlywheelSysId/robot.py +++ b/StateSpaceFlywheelSysId/robot.py @@ -105,7 +105,3 @@ def teleopPeriodic(self) -> None: # duty cycle = voltage / battery voltage nextVoltage = self.loop.U() self.motor.setVoltage(nextVoltage) - - -if __name__ == "__main__": - wpilib.run(MyRobot) diff --git a/StatefulAutonomous/robot.py b/StatefulAutonomous/robot.py index 0574f2d..6a19257 100755 --- a/StatefulAutonomous/robot.py +++ b/StatefulAutonomous/robot.py @@ -49,7 +49,3 @@ def teleopInit(self): def teleopPeriodic(self): pass - - -if __name__ == "__main__": - wpilib.run(MyRobot) diff --git a/SwerveBot/robot.py b/SwerveBot/robot.py index 4a77e7d..5a8d682 100644 --- a/SwerveBot/robot.py +++ b/SwerveBot/robot.py @@ -63,7 +63,3 @@ def driveWithJoystick(self, fieldRelative: bool) -> None: ) self.swerve.drive(xSpeed, ySpeed, rot, fieldRelative, self.getPeriod()) - - -if __name__ == "__main__": - wpilib.run(MyRobot) diff --git a/TankDrive/robot.py b/TankDrive/robot.py index e118710..92546f9 100755 --- a/TankDrive/robot.py +++ b/TankDrive/robot.py @@ -31,7 +31,3 @@ def robotInit(self): def teleopPeriodic(self): self.robotDrive.tankDrive(-self.leftStick.getY(), -self.rightStick.getY()) - - -if __name__ == "__main__": - wpilib.run(MyRobot) diff --git a/TankDriveXboxController/robot.py b/TankDriveXboxController/robot.py index bb6807c..ecd40b8 100755 --- a/TankDriveXboxController/robot.py +++ b/TankDriveXboxController/robot.py @@ -36,7 +36,3 @@ def teleopPeriodic(self): self.robotDrive.tankDrive( -self.driverController.getLeftY(), -self.driverController.getRightY() ) - - -if __name__ == "__main__": - wpilib.run(MyRobot) diff --git a/Timed/src/robot.py b/Timed/src/robot.py index 1741888..e34984b 100755 --- a/Timed/src/robot.py +++ b/Timed/src/robot.py @@ -51,7 +51,3 @@ def teleopPeriodic(self): if self.timer.advanceIfElapsed(1): self.logger.info("%d loops / second", self.loops) self.loops = 0 - - -if __name__ == "__main__": - wpilib.run(MyRobot) diff --git a/Ultrasonic/robot.py b/Ultrasonic/robot.py index d4705d4..d33a781 100644 --- a/Ultrasonic/robot.py +++ b/Ultrasonic/robot.py @@ -52,7 +52,3 @@ def testPeriodic(self): def testExit(self): # Enable automatic mode self.rangeFinder.setAutomaticMode(True) - - -if __name__ == "__main__": - wpilib.run(MyRobot) diff --git a/UltrasonicPID/robot.py b/UltrasonicPID/robot.py index db65ec5..938f482 100644 --- a/UltrasonicPID/robot.py +++ b/UltrasonicPID/robot.py @@ -61,7 +61,3 @@ def autonomousPeriodic(self): # disable input squaring -- PID output is linear self.robotDrive.arcadeDrive(pidOutput, 0, False) - - -if __name__ == "__main__": - wpilib.run(MyRobot) diff --git a/run_tests.sh b/run_tests.sh index f6e46d4..a52089f 100755 --- a/run_tests.sh +++ b/run_tests.sh @@ -93,7 +93,7 @@ fi for t in ${TESTS}; do pushd $t > /dev/null pwd - if ! python3 robot.py test --builtin "${@:2}"; then + if ! python3 -m robotpy test --builtin "${@:2}"; then EC=$? echo "Test in $(pwd) failed" exit 1