From 4681cc018f7d10a3f5c0d252bc72bfb02d64f78d Mon Sep 17 00:00:00 2001 From: sciencewhiz Date: Sat, 25 Jul 2026 12:54:24 -0700 Subject: [PATCH] Replace instances of NiDS controllers in examples --- examples/robot/ArcadeDriveXboxController/robot.py | 2 +- examples/robot/DifferentialDriveBot/robot.py | 2 +- examples/robot/DifferentialDrivePoseEstimator/robot.py | 2 +- examples/robot/DriveDistanceOffboard/robotcontainer.py | 4 ++-- examples/robot/HatchbotInlined/robotcontainer.py | 2 +- examples/robot/HatchbotTraditional/robotcontainer.py | 2 +- examples/robot/MecanumBot/robot.py | 2 +- examples/robot/MecanumDrivePoseEstimator/robot.py | 2 +- examples/robot/RapidReactCommandBot/rapidreactcommandbot.py | 6 +++--- examples/robot/SimpleDifferentialDriveSimulation/robot.py | 2 +- examples/robot/SwerveBot/robot.py | 2 +- examples/robot/SwerveDrivePoseEstimator/robot.py | 2 +- examples/robot/SysId/sysidroutinebot.py | 6 +++--- examples/robot/TankDriveXboxController/robot.py | 2 +- 14 files changed, 19 insertions(+), 19 deletions(-) diff --git a/examples/robot/ArcadeDriveXboxController/robot.py b/examples/robot/ArcadeDriveXboxController/robot.py index ec85684b4..c270f39ff 100755 --- a/examples/robot/ArcadeDriveXboxController/robot.py +++ b/examples/robot/ArcadeDriveXboxController/robot.py @@ -21,7 +21,7 @@ def __init__(self): left_motor = wpilib.PWMSparkMax(0) right_motor = wpilib.PWMSparkMax(1) self.robot_drive = wpilib.DifferentialDrive(left_motor, right_motor) - self.driver_controller = wpilib.NiDsXboxController(0) + self.driver_controller = wpilib.XboxController(0) # We need to invert one side of the drivetrain so that positive voltages # result in both sides moving forward. Depending on how your robot's diff --git a/examples/robot/DifferentialDriveBot/robot.py b/examples/robot/DifferentialDriveBot/robot.py index 5e590fc5b..7af124fd9 100755 --- a/examples/robot/DifferentialDriveBot/robot.py +++ b/examples/robot/DifferentialDriveBot/robot.py @@ -15,7 +15,7 @@ class MyRobot(wpilib.TimedRobot): def __init__(self) -> None: super().__init__() - self.controller = wpilib.NiDsXboxController(0) + self.controller = wpilib.XboxController(0) self.drive = Drivetrain() # Slew rate limiters to make joystick inputs more gentle; 1/3 sec from 0 to 1. diff --git a/examples/robot/DifferentialDrivePoseEstimator/robot.py b/examples/robot/DifferentialDrivePoseEstimator/robot.py index 435976bd2..8c7e5226b 100644 --- a/examples/robot/DifferentialDrivePoseEstimator/robot.py +++ b/examples/robot/DifferentialDrivePoseEstimator/robot.py @@ -19,7 +19,7 @@ def __init__(self) -> None: self.inst = ntcore.NetworkTableInstance.get_default() self.double_array_topic = self.inst.get_double_array_topic("doubleArrayTopic") - self.controller = wpilib.NiDsXboxController(0) + self.controller = wpilib.XboxController(0) self.drive = Drivetrain(self.double_array_topic) # Slew rate limiters to make joystick inputs more gentle; 1/3 sec from 0 to 1. diff --git a/examples/robot/DriveDistanceOffboard/robotcontainer.py b/examples/robot/DriveDistanceOffboard/robotcontainer.py index 64f641567..91336afec 100644 --- a/examples/robot/DriveDistanceOffboard/robotcontainer.py +++ b/examples/robot/DriveDistanceOffboard/robotcontainer.py @@ -33,7 +33,7 @@ def __init__(self): ) # The driver's controller - self.driver_controller = commands2.button.CommandNiDsXboxController( + self.driver_controller = commands2.button.CommandXboxController( constants.OIConstants.DRIVER_CONTROLLER_PORT ) @@ -58,7 +58,7 @@ def configure_button_bindings(self): """ Use this method to define your button->command mappings. Buttons can be created via the button factories on commands2.button.CommandGenericHID or one of its - subclasses (commands2.button.CommandJoystick or command2.button.CommandNiDsXboxController). + subclasses (commands2.button.CommandJoystick or command2.button.CommandXboxController). """ # Configure your button bindings here diff --git a/examples/robot/HatchbotInlined/robotcontainer.py b/examples/robot/HatchbotInlined/robotcontainer.py index 8b912bbf4..dc1701ee0 100644 --- a/examples/robot/HatchbotInlined/robotcontainer.py +++ b/examples/robot/HatchbotInlined/robotcontainer.py @@ -42,7 +42,7 @@ def __init__(self) -> None: ) # The driver's controller - self.driver_controller = commands2.button.CommandNiDsPS4Controller( + self.driver_controller = commands2.button.CommandDualShock4Controller( constants.DRIVER_CONTROLLER_PORT ) diff --git a/examples/robot/HatchbotTraditional/robotcontainer.py b/examples/robot/HatchbotTraditional/robotcontainer.py index a8cb38622..fd1bfc7e6 100644 --- a/examples/robot/HatchbotTraditional/robotcontainer.py +++ b/examples/robot/HatchbotTraditional/robotcontainer.py @@ -32,7 +32,7 @@ class RobotContainer: def __init__(self) -> None: # The driver's controller - # self.driver_controller = wpilib.NiDsXboxController(constants.DRIVER_CONTROLLER_PORT) + # self.driver_controller = wpilib.XboxController(constants.DRIVER_CONTROLLER_PORT) self.driver_controller = wpilib.Joystick(constants.DRIVER_CONTROLLER_PORT) # The robot's subsystems diff --git a/examples/robot/MecanumBot/robot.py b/examples/robot/MecanumBot/robot.py index 3fb07a317..a120f44f4 100755 --- a/examples/robot/MecanumBot/robot.py +++ b/examples/robot/MecanumBot/robot.py @@ -15,7 +15,7 @@ class MyRobot(wpilib.TimedRobot): def __init__(self) -> None: super().__init__() - self.controller = wpilib.NiDsXboxController(0) + self.controller = wpilib.XboxController(0) self.mecanum = Drivetrain() # Slew rate limiters to make joystick inputs more gentle; 1/3 sec from 0 to 1. diff --git a/examples/robot/MecanumDrivePoseEstimator/robot.py b/examples/robot/MecanumDrivePoseEstimator/robot.py index c64c55155..247694001 100644 --- a/examples/robot/MecanumDrivePoseEstimator/robot.py +++ b/examples/robot/MecanumDrivePoseEstimator/robot.py @@ -15,7 +15,7 @@ class MyRobot(wpilib.TimedRobot): def __init__(self) -> None: super().__init__() - self.controller = wpilib.NiDsXboxController(0) + self.controller = wpilib.XboxController(0) self.mecanum = Drivetrain() # Slew rate limiters to make joystick inputs more gentle; 1/3 sec from 0 to 1. diff --git a/examples/robot/RapidReactCommandBot/rapidreactcommandbot.py b/examples/robot/RapidReactCommandBot/rapidreactcommandbot.py index 617640d1a..ef410fa9e 100644 --- a/examples/robot/RapidReactCommandBot/rapidreactcommandbot.py +++ b/examples/robot/RapidReactCommandBot/rapidreactcommandbot.py @@ -5,7 +5,7 @@ # import commands2 -from commands2.button import CommandNiDsXboxController, Trigger +from commands2.button import CommandXboxController, Trigger from constants import AutoConstants, OIConstants, ShooterConstants from subsystems.drive import Drive @@ -31,7 +31,7 @@ def __init__(self) -> None: self.pneumatics = Pneumatics() # The driver's controller - self.driver_controller = CommandNiDsXboxController( + self.driver_controller = CommandXboxController( OIConstants.DRIVER_CONTROLLER_PORT ) @@ -73,7 +73,7 @@ def configure_bindings(self) -> None: ) # Toggle compressor with the Start button - self.driver_controller.start().toggle_on_true( + self.driver_controller.menu().toggle_on_true( self.pneumatics.disable_compressor_command() ) diff --git a/examples/robot/SimpleDifferentialDriveSimulation/robot.py b/examples/robot/SimpleDifferentialDriveSimulation/robot.py index 672d92685..e8c207451 100644 --- a/examples/robot/SimpleDifferentialDriveSimulation/robot.py +++ b/examples/robot/SimpleDifferentialDriveSimulation/robot.py @@ -14,7 +14,7 @@ class MyRobot(wpilib.TimedRobot): def __init__(self) -> None: super().__init__() - self.controller = wpilib.NiDsXboxController(0) + self.controller = wpilib.XboxController(0) # Slew rate limiters to make joystick inputs more gentle; 1/3 sec from 0 # to 1. diff --git a/examples/robot/SwerveBot/robot.py b/examples/robot/SwerveBot/robot.py index e98bf39cb..21f3e7a7d 100644 --- a/examples/robot/SwerveBot/robot.py +++ b/examples/robot/SwerveBot/robot.py @@ -14,7 +14,7 @@ class MyRobot(wpilib.TimedRobot): def __init__(self) -> None: """Robot initialization function""" super().__init__() - self.controller = wpilib.NiDsXboxController(0) + self.controller = wpilib.XboxController(0) self.swerve = drivetrain.Drivetrain() # Slew rate limiters to make joystick inputs more gentle; 1/3 sec from 0 to 1. diff --git a/examples/robot/SwerveDrivePoseEstimator/robot.py b/examples/robot/SwerveDrivePoseEstimator/robot.py index 2c40fabb3..8575575d4 100644 --- a/examples/robot/SwerveDrivePoseEstimator/robot.py +++ b/examples/robot/SwerveDrivePoseEstimator/robot.py @@ -15,7 +15,7 @@ class MyRobot(wpilib.TimedRobot): def __init__(self) -> None: super().__init__() - self.controller = wpilib.NiDsXboxController(0) + self.controller = wpilib.XboxController(0) self.swerve = Drivetrain() # Slew rate limiters to make joystick inputs more gentle; 1/3 sec from 0 to 1. diff --git a/examples/robot/SysId/sysidroutinebot.py b/examples/robot/SysId/sysidroutinebot.py index 033248489..4e7bc2c0a 100644 --- a/examples/robot/SysId/sysidroutinebot.py +++ b/examples/robot/SysId/sysidroutinebot.py @@ -5,7 +5,7 @@ # from commands2 import Command -from commands2.button import CommandNiDsXboxController +from commands2.button import CommandXboxController from commands2.sysid import SysIdRoutine from subsystems.drive import Drive @@ -27,7 +27,7 @@ def __init__(self) -> None: self.shooter = Shooter() # The driver's controller - self.controller = CommandNiDsXboxController(OIConstants.DRIVER_CONTROLLER_PORT) + self.controller = CommandXboxController(OIConstants.DRIVER_CONTROLLER_PORT) def configure_bindings(self) -> None: """Use this method to define bindings between conditions and commands. These are useful for @@ -65,7 +65,7 @@ def configure_bindings(self) -> None: # Control the shooter wheel with the left trigger self.shooter.set_default_command( - self.shooter.run_shooter(self.controller.get_left_trigger_axis) + self.shooter.run_shooter(self.controller.get_left_trigger) ) self.controller.a().and_(self.controller.left_bumper()).while_true( diff --git a/examples/robot/TankDriveXboxController/robot.py b/examples/robot/TankDriveXboxController/robot.py index 8a5435214..103e09337 100755 --- a/examples/robot/TankDriveXboxController/robot.py +++ b/examples/robot/TankDriveXboxController/robot.py @@ -21,7 +21,7 @@ def __init__(self): left_motor = wpilib.PWMSparkMax(0) right_motor = wpilib.PWMSparkMax(1) self.robot_drive = wpilib.DifferentialDrive(left_motor, right_motor) - self.driver_controller = wpilib.NiDsXboxController(0) + self.driver_controller = wpilib.XboxController(0) # We need to invert one side of the drivetrain so that positive voltages # result in both sides moving forward. Depending on how your robot's