diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 1c9800b1..adaa23f6 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 574cd39c..cb80cf5f 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 15766809..ddd88cd8 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 b9faf3bb..7a05e969 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 56664caf..7d5df6b7 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 d3f2cc25..15a6629e 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 d7f6ae04..c3ecb437 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 1a59dfa2..5a4043ed 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 0c98d554..157fc3f3 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 d9e7c05e..9cb119fa 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 553c9f85..5adf34ce 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 8e2d50fb..4145575b 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 0b7561ab..e845be04 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 8837dc7a..9415f723 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 91ea2bf9..523d51e0 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 2bbe997f..1703797b 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 aa131a5e..7cdf6162 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 ec9baaac..c6a5d6ad 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 75e1705d..fabab02a 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 c00bca1c..467b3ea9 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 0b7561ab..e845be04 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 c11a5a94..02e857aa 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 7d01f485..06ce4663 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 2ffd7691..5c7949ac 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 0b7561ab..e845be04 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 faeb16b1..1a05084f 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 92a7d81d..0a85fcab 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 92a7d81d..0a85fcab 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 1357a116..f08872e9 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 f19e79a8..a955f2e6 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 f13feaa8..5401ead1 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 8d5ff9e9..753e0c8f 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 1bb7b835..584814f0 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 e586b8ed..90552da7 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 94448223..7d8ca9d5 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 a074c1c1..c6f99742 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 90de1c56..b1b137b3 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 b26f1af2..822d4968 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 e30ca781..f13fce01 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 e5d324d8..0a6d24d0 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 5d094cc8..2658caf4 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 f2ef4409..881ad995 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 9295fd79..36c80903 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 159bfc96..5446199e 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 4cbe47a3..96b01dda 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 77ea9f23..6653f26e 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 5475cfd6..b2ff7cb6 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 8ca1340e..0cfc34e6 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 d7f6ae04..c3ecb437 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 d7f6ae04..c3ecb437 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 ba992250..e8905885 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 5757a33f..988e0374 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 80b9ad68..b5ca017d 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 1183ee2a..c6aeeedc 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 0574f2d1..6a19257f 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 4a77e7d9..5a8d6825 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 e1187103..92546f91 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 bb6807ca..ecd40b8a 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 17418880..e34984b3 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 d4705d48..d33a781c 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 db65ec50..938f4829 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 f6e46d49..a52089f2 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