Example #1
0
class MyRobot(CommandBasedRobot):
    def robotInit(self):
        Command.getRobot = lambda x=0: self
        self.drivetrain = Drive.Drive()
        self.autonomous = Autonomous()

    def autonomousInit(self):
        self.autonomous.start()
Example #2
0
class MyRobot(CommandBasedRobot):
    def robotInit(self):
        Command.getRobot = lambda x=0: self
        MyRobot.drivetrain = Drive.Drive()
        MyRobot.leftStick = oi.getLeftStick()
        MyRobot.rightStick = oi.getRightStick()
        self.Autonomous = Autonomous()

    def autonomousInit(self):
        self.Autonomous.start()
Example #3
0
class MyRobot(wpilib.TimedRobot):
    def robotInit(self):
        """This function is run when the robot is first started up and should be
        used for any initialization code."""

        self.drivetrain = DriveTrain(self)
        self.elevator = Elevator(self)
        self.wrist = Wrist(self)
        self.claw = Claw()
        self.oi = OI(self)

        # instantiate the command used for the autonomous period
        self.autonomousCommand = Autonomous(self)

        # Show what command your subsystem is running on the SmartDashboard
        wpilib.SmartDashboard.putData(self.drivetrain)
        wpilib.SmartDashboard.putData(self.elevator)
        wpilib.SmartDashboard.putData(self.wrist)
        wpilib.SmartDashboard.putData(self.claw)

        wpilib.LiveWindow.getInstance().setEnabled(True)

    def autonomousInit(self):
        # schedule the autonomous command (example)
        self.autonomousCommand.start()

    def autonomousPeriodic(self):
        """This function is called periodically during autonomous"""
        Scheduler.getInstance().run()
        self.log()

    def teleopInit(self):
        # This makes sure that the autonomous stops running when
        # teleop starts running. If you want the autonomous to
        # continue until interrupted by another command, remove
        # this line or comment it out.
        self.autonomousCommand.cancel()

    def teleopPeriodic(self):
        """This function is called periodically during operator control"""
        Scheduler.getInstance().run()
        self.log()

    def testPeriodic(self):
        """This function is called periodically during test mode"""
        wpilib.LiveWindow.getInstance().updateValues()

    def log(self):
        """The log method puts interesting information to the SmartDashboard."""
        self.wrist.log()
        self.elevator.log()
        self.drivetrain.log()
        self.claw.log()
Example #4
0
class MyRobot(wpilib.IterativeRobot):
    
    def robotInit(self):
        '''This function is run when the robot is first started up and should be
           used for any initialization code.'''
        
        self.drivetrain = DriveTrain(self)
        self.elevator = Elevator(self)
        self.wrist = Wrist(self)
        self.claw = Claw()
        self.oi = OI(self)
        
        # instantiate the command used for the autonomous period
        self.autonomousCommand = Autonomous(self)
        
        # Show what command your subsystem is running on the SmartDashboard
        wpilib.SmartDashboard.putData(self.drivetrain)
        wpilib.SmartDashboard.putData(self.elevator)
        wpilib.SmartDashboard.putData(self.wrist)
        wpilib.SmartDashboard.putData(self.claw)
        
    def autonomousInit(self):
        # schedule the autonomous command (example)
        self.autonomousCommand.start()
        
    def autonomousPeriodic(self):
        '''This function is called periodically during autonomous'''
        Scheduler.getInstance().run()
        self.log()
        
    def teleopInit(self):
        # This makes sure that the autonomous stops running when
        # teleop starts running. If you want the autonomous to 
        # continue until interrupted by another command, remove
        # this line or comment it out.
        self.autonomousCommand.cancel()
    
    def teleopPeriodic(self):
        '''This function is called periodically during operator control'''
        Scheduler.getInstance().run()
        self.log()
        
    def testPeriodic(self):
        '''This function is called periodically during test mode'''
        wpilib.LiveWindow.run()
        
    def log(self):
        '''The log method puts interesting information to the SmartDashboard.'''
        self.wrist.log()
        self.elevator.log()
        self.drivetrain.log()
        self.claw.log()
Example #5
0
    def robotInit(self):
        """This function is run when the robot is first started up and should be
           used for any initialization code."""

        self.drivetrain = DriveTrain(self)
        self.elevator = Elevator(self)
        self.wrist = Wrist(self)
        self.claw = Claw()
        self.oi = OI(self)

        # instantiate the command used for the autonomous period
        self.autonomousCommand = Autonomous(self)

        # Show what command your subsystem is running on the SmartDashboard
        wpilib.SmartDashboard.putData(self.drivetrain)
        wpilib.SmartDashboard.putData(self.elevator)
        wpilib.SmartDashboard.putData(self.wrist)
        wpilib.SmartDashboard.putData(self.claw)
Example #6
0
    def __init__(self, robot):

        self.joy = wpilib.Joystick(0)

        # Put Some buttons on the SmartDashboard
        SmartDashboard.putData("Elevator Bottom",
                               SetElevatorSetpoint(robot, 0))
        SmartDashboard.putData("Elevator Platform",
                               SetElevatorSetpoint(robot, 0.2))
        SmartDashboard.putData("Elevator Top", SetElevatorSetpoint(robot, 0.3))

        SmartDashboard.putData("Wrist Horizontal", SetWristSetpoint(robot, 0))
        SmartDashboard.putData("Raise Wrist", SetWristSetpoint(robot, -45))

        SmartDashboard.putData("Open Claw", OpenClaw(robot))
        SmartDashboard.putData("Close Claw", CloseClaw(robot))

        SmartDashboard.putData("Deliver Soda", Autonomous(robot))

        # Create some buttons
        d_up = JoystickButton(self.joy, 5)
        d_right = JoystickButton(self.joy, 6)
        d_down = JoystickButton(self.joy, 7)
        d_left = JoystickButton(self.joy, 8)
        l2 = JoystickButton(self.joy, 9)
        r2 = JoystickButton(self.joy, 10)
        l1 = JoystickButton(self.joy, 11)
        r1 = JoystickButton(self.joy, 12)

        # Connect the buttons to commands
        d_up.whenPressed(SetElevatorSetpoint(robot, 0.2))
        d_down.whenPressed(SetElevatorSetpoint(robot, -0.2))
        d_right.whenPressed(CloseClaw(robot))
        d_left.whenPressed(OpenClaw(robot))

        r1.whenPressed(PrepareToPickup(robot))
        r2.whenPressed(Pickup(robot))
        l1.whenPressed(Place(robot))
        l2.whenPressed(Autonomous(robot))
Example #7
0
 def robotInit(self):
     '''This function is run when the robot is first started up and should be
        used for any initialization code.'''
     
     self.drivetrain = DriveTrain(self)
     self.elevator = Elevator(self)
     self.wrist = Wrist(self)
     self.claw = Claw()
     self.oi = OI(self)
     
     # instantiate the command used for the autonomous period
     self.autonomousCommand = Autonomous(self)
     
     # Show what command your subsystem is running on the SmartDashboard
     wpilib.SmartDashboard.putData(self.drivetrain)
     wpilib.SmartDashboard.putData(self.elevator)
     wpilib.SmartDashboard.putData(self.wrist)
     wpilib.SmartDashboard.putData(self.claw)
Example #8
0
class Robot(CommandBasedRobot):
    def getModuleName(self):
        return "VexBot"

    def getVersion(self):
        return "0.0.0-py"

    def robotInit(self):
        subsystems.init()

        self.teleopCommand = TankDrive()
        #self.teleopCommand = MecDrive()
        self.autonomousCommand = Autonomous()

    def autonomousInit(self):
        self.autonomousCommand.cancel()
        self.autonomousCommand.start()

    def teleopInit(self):
        self.autonomousCommand.cancel()
        self.teleopCommand.start()
Example #9
0
 def robotInit(self):
     Command.getRobot = lambda x=0: self
     MyRobot.drivetrain = Drive.Drive()
     MyRobot.leftStick = oi.getLeftStick()
     MyRobot.rightStick = oi.getRightStick()
     self.Autonomous = Autonomous()
Example #10
0
 def robotInit(self):
     Command.getRobot = lambda x=0: self
     self.drivetrain = Drive.Drive()
     self.autonomous = Autonomous()
Example #11
0
    def robotInit(self):
        subsystems.init()

        self.teleopCommand = TankDrive()
        #self.teleopCommand = MecDrive()
        self.autonomousCommand = Autonomous()