コード例 #1
0
ファイル: move.py プロジェクト: bullbots/DeepSpacePy
 def initialize(self):
     Command.getRobot().drivetrain.set(ControlMode.PercentOutput,
                                       self.power, self.power)
コード例 #2
0
ファイル: move.py プロジェクト: bullbots/DeepSpacePy
 def end(self):
     Command.getRobot().drivetrain.set(ControlMode.PercentOutput, 0.0, 0.0)
コード例 #3
0
 def initialize(self):
     Command.getRobot().intakeOutput.panelPlace(
         IntakeOutput.PanelPutOrTake.TAKE)
     Command.getRobot().intakeOutput.mode = self.mode
コード例 #4
0
 def __init__(self, mode):
     super().__init__(name="SetObjectMode",
                      subsystem=Command.getRobot().intakeOutput)
     self.mode = mode
     self.logger = logging.getLogger(self.getName())
コード例 #5
0
ファイル: put_panel.py プロジェクト: bullbots/DeepSpacePy
 def initialize(self):
     Command.getRobot().intakeOutput.panelPlace(
         IntakeOutput.PanelPutOrTake.PUT)
コード例 #6
0
 def initialize(self):
     Command.getRobot().liftElevator.setElevatorReference(6.5)
コード例 #7
0
 def __init__(self, position):
     super().__init__(name="ActivateArms {}".format(position),
                      subsystem=Command.getRobot().intakeOutput)
     self.position = position
コード例 #8
0
 def initialize(self):
     Command.getRobot().liftElevator.resetEncoders()
コード例 #9
0
ファイル: oi.py プロジェクト: bullbots/DeepSpacePy
    def __init__(self):
        # Create Joysticks
        self.stick = Joystick(0)
        self.gamepad = Joystick(1)

        # Create Buttons
        self.trigger = JoystickButton(self.stick, 1)
        self.button2 = JoystickButton(self.stick, 2)
        self.button3 = JoystickButton(self.stick, 3)
        self.button4 = JoystickButton(self.stick, 4)
        self.button5 = JoystickButton(self.stick, 5)
        self.button6 = JoystickButton(self.stick, 6)
        self.button7 = JoystickButton(self.stick, 7)
        self.button8 = JoystickButton(self.stick, 8)
        self.button9 = JoystickButton(self.stick, 9)
        self.button10 = JoystickButton(self.stick, 10)
        self.button11 = JoystickButton(self.stick, 11)

        self.pad1 = JoystickButton(self.gamepad, 1)
        self.pad2 = JoystickButton(self.gamepad, 2)
        self.pad3 = JoystickButton(self.gamepad, 3)
        self.pad4 = JoystickButton(self.gamepad, 4)
        self.pad5 = JoystickButton(self.gamepad, 5)
        self.pad6 = JoystickButton(self.gamepad, 6)
        self.pad7 = JoystickButton(self.gamepad, 7)
        self.pad8 = JoystickButton(self.gamepad, 8)
        self.pad9 = JoystickButton(self.gamepad, 9)

        self.climb2 = ComboButton(self.pad6, self.button6)
        self.climb3 = ComboButton(self.pad5, self.button6)

        # Test buttons
        self.test = ComboButton(self.pad2, self.button6)

        # Command hookups
        self.trigger.whenPressed(Intake())
        self.trigger.whenReleased(NeutralIntake())

        # self.button2.whileHeld(Align(3.0))

        self.button8.whenPressed(
            type(
                '', (InstantCommand, ), {
                    'initialize':
                    lambda: Command.getRobot().liftElevator.resetEncoders()
                }))

        self.pad1.whenPressed(SetObjectMode(
            IntakeOutput.BallOrHatchMode.HATCH))
        self.pad1.whenReleased(SetObjectMode(
            IntakeOutput.BallOrHatchMode.BALL))
        Command.getRobot().intakeOutput.mode = IntakeOutput.BallOrHatchMode.HATCH if \
            self.pad1.get() else IntakeOutput.BallOrHatchMode.HATCH

        self.test.whenPressed(TopConditional())
        self.pad3.whenPressed(MiddleConditional())
        self.pad4.whenPressed(LowConditional())

        self.climb2.whenPressed(TwoClimbG())
        self.climb3.whenPressed(OneClimbG())

        self.pad7.whenPressed(MoveElevator(1))
        self.pad8.whenPressed(HighCenter())
コード例 #10
0
 def initialize(self):
     Command.getRobot().intakeOutput.setPosition(self.position)
コード例 #11
0
ファイル: inhale_exhale.py プロジェクト: bullbots/DeepSpacePy
 def __init__(self, key):
     super().__init__(name="InhaleExhale {}".format(key),
                      subsystem=Command.getRobot().intakeOutput)
     self.key = key
コード例 #12
0
ファイル: inhale_exhale.py プロジェクト: bullbots/DeepSpacePy
 def initialize(self):
     Command.getRobot().intakeOutput.giveOrTakeCargo(self.key)
コード例 #13
0
 def __init__(self):
     super().__init__(subsystem=Command.getRobot().liftElevator)
コード例 #14
0
ファイル: move.py プロジェクト: bullbots/DeepSpacePy
 def __init__(self, power):
     super().__init__(name="Move {}".format(power),
                      subsystem=Command.getRobot().drivetrain)
     self.power = power
コード例 #15
0
ファイル: lift_drive.py プロジェクト: bullbots/DeepSpacePy
 def initialize(self):
     Command.getRobot().liftElevator.liftDrive(self.power)
コード例 #16
0
 def condition(self):
     return Command.getRobot(
     ).intakeOutput.mode == IntakeOutput.BallOrHatchMode.BALL
コード例 #17
0
ファイル: lift_drive.py プロジェクト: bullbots/DeepSpacePy
 def end(self):
     Command.getRobot().liftElevator.liftDrive(0.0)
コード例 #18
0
 def __init__(self):
     super().__init__(name=self.__class__,
                      subsystem=Command.getRobot().liftElevator)
コード例 #19
0
ファイル: lift_drive.py プロジェクト: bullbots/DeepSpacePy
 def __init__(self, power):
     super().__init__(name="LiftDrive {}".format(power),
                      subsystem=Command.getRobot().liftElevator)
     self.power = power
コード例 #20
0
ファイル: put_panel.py プロジェクト: bullbots/DeepSpacePy
 def __init__(self):
     super().__init__(subsystem=Command.getRobot().intakeOutput)
コード例 #21
0
 def initialize(self):
     if self.mode == IntakeOutput.IntakeInOutNeutral.NEUTRAL:
         self.logger.info("NEUTRAL")
         Command.getRobot().intakeOutput.setArmPower(0.0)
         Command.getRobot().intakeOutput.setPosition(IntakeOutput.Position.UP)
     elif self.mode == IntakeOutput.IntakeInOutNeutral.IN:
         self.logger.info("IN")
         Command.getRobot().intakeOutput.setArmPower(0.5)
         Command.getRobot().intakeOutput.setPosition(IntakeOutput.Position.DOWN)
     elif self.mode == IntakeOutput.IntakeInOutNeutral.OUT:
         self.logger.info("OUT")
         Command.getRobot().intakeOutput.setArmPower(-1.0)
         Command.getRobot().intakeOutput.setPosition(IntakeOutput.Position.DOWN)