Пример #1
0
    def __init__(self, robot):
        '''The Constructor - assign Xbox controller buttons to specific Commands.
        '''

        print("In OI:__init__")

        robot.xbox0 = wpilib.XboxController(0)
        robot.xbox1 = wpilib.XboxController(1)

        stickbutton = StickButton(robot.xbox0, .1)
        shoot = JoystickButton(robot.xbox0, XboxController.Button.kA)
        block = JoystickButton(robot.xbox0, XboxController.Button.kY)
        intake = JoystickButton(robot.xbox0, XboxController.Button.kX)
        shiftup = JoystickButton(robot.xbox0,
                                 XboxController.Button.kBumperRight)
        shiftdown = JoystickButton(robot.xbox0,
                                   XboxController.Button.kBumperLeft)

        togglecamera = JoystickButton(robot.xbox0,
                                      XboxController.Button.kStart)
        togglecamera.whenPressed(ToggleCamera(robot))
        stickbutton.whenPressed(DifferentialDriveWithXbox(robot))
        shoot.whileHeld(Shoot(robot))
        block.toggleWhenPressed(Block(robot))
        intake.whileHeld(Intake_Com(robot))
        shiftup.whenPressed(ShiftUp(robot))
        shiftdown.whenPressed(ShiftDown(robot))
Пример #2
0
 def __init(self, robot):
     self.addSequential(Shoot(robot))
     self.addSequential(WaitCommand(timeout=0.3))
     self.addSequential(Unblock(robot))
     self.addSequential(WaitCommand(timeout=5))
     #TODO: figure out how long the shooter needs to run in order to empty
     self.addSequential(StopShooting(robot))
     self.addParallel(Block(robot))
 def __init__(self, robot):
     super().__init__()
     self.addSequential(CloseClaw(robot))
     self.addSequential(WaitForPressure(robot), 2)
     if robot.isReal():
         # NOTE: Simulation doesn't currently have the concept of hot.
         self.addSequential(CheckForHotGoal(robot, 2))
     self.addSequential(SetPivotSetpoint(robot, 45))
     self.addSequential(DriveForward(robot, 8, 0.3))
     self.addSequential(Shoot(robot))
Пример #4
0
    def __init__(self, robot):
        '''The Constructor - assign Xbox controller buttons to specific Commands.
        '''

        print("In OI:__init__")

        robot.xbox0 = wpilib.XboxController(0)
        robot.xbox1 = wpilib.XboxController(1)

        stickbutton = StickButton(robot.xbox0, .1)
        shoot = JoystickButton(robot.xbox0, XboxController.Button.kA)
        block = JoystickButton(robot.xbox0, XboxController.Button.kY)
        intake = JoystickButton(robot.xbox0, XboxController.Button.kX)
        shiftup = JoystickButton(robot.xbox0,
                                 XboxController.Button.kBumperRight)
        shiftdown = JoystickButton(robot.xbox0,
                                   XboxController.Button.kBumperLeft)
        triggerbutton = TriggerButton(robot.xbox1, .1)
        extendclimber = JoystickButton(robot.xbox1, XboxController.Button.kA)

        agitate = JoystickButton(robot.xbox0, XboxController.Button.kA)

        #releaseshoot = JoystickButton(robot.xbox0, XboxController.Button.kA)
        eject = JoystickButton(robot.xbox0, XboxController.Button.kB)

        togglecamera = JoystickButton(robot.xbox0,
                                      XboxController.Button.kStart)
        togglecamera.whenPressed(ToggleCamera(robot))
        stickbutton.whenPressed(DifferentialDriveWithXbox(robot))
        shoot.whileHeld(Shoot(robot))
        block.toggleWhenPressed(Block(robot))
        intake.whileHeld(Intake_Com(robot))
        shiftup.whenPressed(ShiftUp(robot))
        shiftdown.whenPressed(ShiftDown(robot))
        triggerbutton.whenPressed(Climbwithtriggers(robot))
        extendclimber.toggleWhenPressed(Extendclimber(robot))

        agitate.whileHeld(Agitate(robot))

        #releaseshoot.whileHeld(ReleaseShoot(robot))
        eject.whileHeld(Cuntake(robot))
Пример #5
0
    def __init__(self, robot):
        self.joystick = wpilib.Joystick(0)

        JoystickButton(self.joystick, 12).whenPressed(LowGoal(robot))
        JoystickButton(self.joystick, 10).whenPressed(Collect(robot))

        JoystickButton(self.joystick,
                       11).whenPressed(SetPivotSetpoint(robot, Pivot.SHOOT))
        JoystickButton(self.joystick,
                       9).whenPressed(SetPivotSetpoint(robot,
                                                       Pivot.SHOOT_NEAR))

        DoubleButton(self.joystick, 2, 3).whenActive(Shoot(robot))

        # SmartDashboard Buttons
        SmartDashboard.putData("Drive Forward", DriveForward(robot, 2.25))
        SmartDashboard.putData("Drive Backward", DriveForward(robot, -2.25))
        SmartDashboard.putData("Start Rollers",
                               SetCollectionSpeed(robot, Collector.FORWARD))
        SmartDashboard.putData("Stop Rollers",
                               SetCollectionSpeed(robot, Collector.STOP))
        SmartDashboard.putData("Reverse Rollers",
                               SetCollectionSpeed(robot, Collector.REVERSE))