예제 #1
0
    def robotInit(self):
        """
            Define all motor controllers, joysticks, Pneumatics, etc. here so you can usem in teleop/auton.

        """

        self.drive_motor1 = wpilib.Talon(0)
        self.drive_motor2 = wpilib.Talon(1)
        self.drive_motor3 = wpilib.Talon(2)
        self.drive_motor4 = wpilib.Talon(3)

        self.winch_motor1 = wpilib.Talon(5)
        self.winch_motor2 = wpilib.Talon(6)

        self.mecDrive = wpilib.RobotDrive(self.frontLeftChannel,
                                          self.rearLeftChannel,
                                          self.frontRightChannel,
                                          self.rearRightChannel)

        self.mecDrive.setExpiration(0.1)

        self.mecDrive.setInvertedMotor(RobotDrive.MotorType.kFrontLeft, True)
        self.mecDrive.setInvertedMotor(RobotDrive.MotorType.kRearLeft, True)

        self.robot_Drive = wpilib.RobotDrive(self.drive_motor1,
                                             self.drive_motor2)

        self.xbox = wpilib.Joystick(0)

        self.forwardWinch = wpilib.buttons.JoystickButton(self.xbox, 3)
        self.reverseWinch = wpilib.buttons.JoystickButton(self.xbox, 2)
예제 #2
0
파일: robot.py 프로젝트: Leo428/Magic
    def createObjects(self):

        self.shiftBaseSolenoid = wpilib.DoubleSolenoid(
            rMap.conf_shifterSolenoid1, rMap.conf_shifterSolenoid2)
        self.rightFrontBaseMotor = CANTalon(rMap.conf_rightFrontBaseTalon)
        self.rightRearBaseMotor = CANTalon(rMap.conf_rightRearBaseTalon)
        self.leftFrontBaseMotor = CANTalon(rMap.conf_leftFrontBaseTalon)
        self.leftRearBaseMotor = CANTalon(rMap.conf_leftRearBaseTalon)

        self.rightFrontBaseMotor.enableControl()
        self.rightRearBaseMotor.enableControl()
        self.rightRearBaseMotor.setControlMode(CANTalon.ControlMode.Follower)
        self.rightRearBaseMotor.set(rMap.conf_rightFrontBaseTalon)

        self.leftFrontBaseMotor.enableControl()
        self.leftRearBaseMotor.enableControl()
        self.leftFrontBaseMotor.setInverted(True)
        self.leftRearBaseMotor.setControlMode(CANTalon.ControlMode.Follower)
        self.leftRearBaseMotor.set(rMap.conf_leftFrontBaseTalon)

        self.leftJoy = Joystick(rMap.conf_left_joy)
        self.rightJoy = Joystick(rMap.conf_right_joy)
        self.xbox = Joystick(rMap.conf_xbox)

        self.robotDrive = wpilib.RobotDrive(self.leftFrontBaseMotor,
                                            self.rightFrontBaseMotor)
예제 #3
0
    def createObjects(self):
        #Sticks
        self.driverStick = wpilib.Joystick(1)
        self.operatorStick = wpilib.Joystick(0)

        #CAN Talons
        self.lf = wpilib.CANTalon(2)
        self.lr = wpilib.CANTalon(3)
        self.rf = wpilib.CANTalon(4)
        self.rb = wpilib.CANTalon(5)

        #robot drive to eventually control our mecanum drive train
        self.robotDrive = wpilib.RobotDrive(self.lf, self.lr, self.rf, self.rb)

        #Intake motor
        self.intakeController = wpilib.CANTalon(6)

        #Shooter motor
        self.intakeController = wpilib.CANTalon(7)

        #Climber motor
        self.climbController = wpilib.CANTalon(8)

        #agitator
        # Maybe be deprecated because of a simpler solution
        self.aggitController = wpilib.CANTalon(9)

        # IMU Gyroscope
        self.navX = navx.AHRS.create_spi()

        #network tables
        self.sd = NetworkTable.getTable('smartdashboard')
        self.viz = NetworkTable.getTable('visiondashboard')
예제 #4
0
    def robotInit(self):
        """
        This function is called upon program startup and
        should be used for any initialization code.
        """
        self.frontLeft = ctre.WPI_TalonSRX(1)
        self.frontRight = ctre.WPI_TalonSRX(3)
        self.rearLeft = ctre.WPI_TalonSRX(2)
        self.rearRight = ctre.WPI_TalonSRX(4)

        self.spool = ctre.WPI_TalonSRX(5)

        #         self.rearLeft.setInverted(True)
        #         self.frontLeft.setInverted(True)

        self.drive = wpilib.RobotDrive(self.frontLeft, self.rearLeft,
                                       self.frontRight, self.rearRight)
        self.stick = wpilib.Joystick(0)

        self.pickUpHandler = 0
        self.pickupTimer = 0

        self.picker = wpilib.Solenoid(0, 1)
        self.rotation = wpilib.Solenoid(0, 2)
        self.thrust = wpilib.Solenoid(0, 3)
        self.transmission = wpilib.Solenoid(0, 4)
예제 #5
0
    def robotInit(self):
        """
        This function is called upon program startup and
        should be used for any initialization code.
        """
        self.br_motor = ctre.wpi_talonsrx.WPI_TalonSRX(1)
        self.bl_motor = ctre.wpi_talonsrx.WPI_TalonSRX(2)
        self.fl_motor = ctre.wpi_talonsrx.WPI_TalonSRX(5)
        self.fr_motor = ctre.wpi_talonsrx.WPI_TalonSRX(7)
        self.fr_motor.setInverted(True)
        self.br_motor.setInverted(True)

        self.robot_drive = wpilib.RobotDrive(self.fl_motor, self.bl_motor,
                                             self.fr_motor, self.br_motor)

        self.joystick = wpilib.Joystick(0)

        self.elevator_motor = ctre.wpi_talonsrx.WPI_TalonSRX(4)
        self.elevator_follower = ctre.wpi_talonsrx.WPI_TalonSRX(10)
        self.elevator_follower.follow(self.elevator_motor)

        self.chomp_relay = wpilib.Relay(3)

        self.servo = wpilib.Servo(2)

        self.timer = wpilib.Timer()

        self.initial_time = 0

        self.chomp_pressed = False

        self.chomp_position = 0

        self.last_button_value = False
예제 #6
0
    def robotInit(self):
        """Robot-wide initialization code should go here"""

        # Basic robot chassis setup
        self.stick = wpilib.Joystick(0)
        self.robot_drive = wpilib.RobotDrive(0, 1)

        # Position gets automatically updated as robot moves
        self.gyro = wpilib.ADXRS450_Gyro()

        # Use PIDController to control angle
        turnController = wpilib.PIDController(self.kP,
                                              self.kI,
                                              self.kD,
                                              self.kF,
                                              self.pidGet,
                                              output=self.pidWrite)
        turnController.setInputRange(-180.0, 180.0)
        turnController.setOutputRange(-1.0, 1.0)
        turnController.setAbsoluteTolerance(self.kToleranceDegrees)
        turnController.setContinuous(True)
        self.turnController = turnController

        self.rotateToAngleRate = 0
        self.i = 0
        self.sd = NetworkTables.getTable("SmartDashboard")
        self.hephestus = NetworkTables.getTable("hephestus")
예제 #7
0
    def robotInit(self):
        """Robot-wide initialization code should go here"""

        self.timer = wpilib.Timer()
        self.timer.start()

        self.navx = navx.AHRS.create_spi()

        self.lstick = wpilib.Joystick(0)

        self.l_motor_master = ctre.WPI_TalonSRX(3)
        self.l_motor_slave = ctre.WPI_TalonSRX(4)

        self.r_motor_master = ctre.WPI_TalonSRX(1)
        self.r_motor_slave = ctre.WPI_TalonSRX(2)

        self.l_motor_slave.set(ControlMode.Follower, 3)
        self.r_motor_slave.set(ControlMode.Follower, 1)

        self.l_motor_master.setInverted(False)
        self.l_motor_slave.setInverted(False)
        self.r_motor_master.setInverted(False)
        self.r_motor_slave.setInverted(False)

        self.l_motor_master.setSensorPhase(True)
        self.r_motor_master.setSensorPhase(False)

        self.robot_drive = wpilib.RobotDrive(self.l_motor_master,
                                             self.r_motor_master)
예제 #8
0
    def robotInit(self):
        """
            Define all motor controllers, joysticks, Pneumatics, etc. here so you can use them in teleop/auton
        """

        self.robotDrive = wpilib.RobotDrive(self.topLeftChannel,
                                            self.bottomLeftChannel,
                                            self.topRightChannel,
                                            self.bottomRightChannel)

        self.stick = wpilib.Joystick(self.joystickChannelDrive)
        self.shooter = wpilib.Joystick(self.joystickChannelShoot)

        self.intakeLeft = wpilib.Talon(self.leftIntakeMotor)
        self.intakeRight = wpilib.Talon(self.rightIntakeMotor)

        self.stage2Left = wpilib.Talon(self.stage2LeftMotor)
        self.stage2Right = wpilib.Talon(self.stage2RightMotor)

        self.stage3Left = wpilib.Talon(self.stage3LeftMotor)
        self.stage3Right = wpilib.Talon(self.stage3RightMotor)

        self.sweeper = wpilib.Talon(self.sweeperMotor)

        self.shifterForward = wpilib.buttons.JoystickButton(
            self.stick, 2)  # Xbox controller button Number 2 (B)
        self.shifterBack = wpilib.buttons.JoystickButton(
            self.stick, 3)  # Xbox controller button Number 3 (X)

        self.double_solenoid_piston = wpilib.DoubleSolenoid(
            2, 3)  # Double Solenoid on port 2 and 3
예제 #9
0
    def __init__(self, robot):

        self.robot = robot

        # Configure drive motors
        self.frontLeftCIM = wpilib.Victor(1)
        self.frontRightCIM = wpilib.Victor(2)
        self.backLeftCIM = wpilib.Victor(3)
        self.backRightCIM = wpilib.Victor(4)
        wpilib.LiveWindow.addActuator("DriveTrain", "Front Left CIM", self.frontLeftCIM)
        wpilib.LiveWindow.addActuator("DriveTrain", "Front Right CIM", self.frontRightCIM)
        wpilib.LiveWindow.addActuator("DriveTrain", "Back Left CIM", self.backLeftCIM)
        wpilib.LiveWindow.addActuator("DriveTrain", "Back Right CIM", self.backRightCIM)

        # Configure the RobotDrive to reflect the fact that all our motors are
        # wired backwards and our drivers sensitivity preferences.
        self.drive = wpilib.RobotDrive(self.frontLeftCIM, self.frontRightCIM, self.backLeftCIM, self.backRightCIM)
        self.drive.setSafetyEnabled(True)
        self.drive.setExpiration(.1)
        self.drive.setSensitivity(.5)
        self.drive.setMaxOutput(1.0)
        self.drive.setInvertedMotor(wpilib.RobotDrive.MotorType.kFrontLeft, True)
        self.drive.setInvertedMotor(wpilib.RobotDrive.MotorType.kFrontRight, True)
        self.drive.setInvertedMotor(wpilib.RobotDrive.MotorType.kRearLeft, True)
        self.drive.setInvertedMotor(wpilib.RobotDrive.MotorType.kRearRight, True)

        # Configure encoders
        self.rightEncoder = wpilib.Encoder(1, 2,
                                           reverseDirection=True,
                                           encodingType=wpilib.Encoder.EncodingType.k4X)
        self.leftEncoder = wpilib.Encoder(3, 4,
                                          reverseDirection=False,
                                          encodingType=wpilib.Encoder.EncodingType.k4X)
        self.rightEncoder.setPIDSourceType(wpilib.Encoder.PIDSourceType.kDisplacement)
        self.leftEncoder.setPIDSourceType(wpilib.Encoder.PIDSourceType.kDisplacement)

        if robot.isReal():
            # Converts to feet
            self.rightEncoder.setDistancePerPulse(0.0785398)
            self.leftEncoder.setDistancePerPulse(0.0785398)
        else:
            # Convert to feet 4in diameter wheels with 360 tick simulated encoders.
            self.rightEncoder.setDistancePerPulse((4*math.pi)/(360*12))
            self.leftEncoder.setDistancePerPulse((4*math.pi)/(360*12))

        wpilib.LiveWindow.addSensor("DriveTrain", "Right Encoder", self.rightEncoder)
        wpilib.LiveWindow.addSensor("DriveTrain", "Left Encoder", self.leftEncoder)

        # Configure gyro
        # -> the original pacgoat example is at channel 2, but that was before WPILib
        #    moved to zero-based indexing. You need to change the gyro channel in
        #    /usr/share/frcsim/models/PacGoat/robots/PacGoat.SDF, from 2 to 0. 
        self.gyro = wpilib.AnalogGyro(0)
        if robot.isReal():
            # TODO: Handle more gracefully
            self.gyro.setSensitivity(0.007)

        wpilib.LiveWindow.addSensor("DriveTrain", "Gyro", self.gyro)

        super().__init__()
예제 #10
0
    def robotInit(self):

        if not wpilib.RobotBase.isSimulation():
            import ctre
            self.motor1 = ctre.CANTalon(1)
            self.motor2 = ctre.CANTalon(2)
            self.motor3 = ctre.CANTalon(3)
            self.motor4 = ctre.CANTalon(4)
        else:
            self.motor1 = wpilib.Talon(1)
            self.motor2 = wpilib.Talon(2)
            self.motor3 = wpilib.Talon(3)
            self.motor4 = wpilib.Talon(4)

    #Defining Constants

#     self.LeftTread = wpilib.Talon(0)
#    self.RightTread = wpilib.Talon(1)
        self.robotDrive = wpilib.RobotDrive(self.motor1, self.motor2,
                                            self.motor3, self.motor4)
        self.xboxController = wpilib.Joystick(0)
        self.xboxAbutton = wpilib.buttons.JoystickButton(
            self.xboxController, 1)
        self.xboxBbutton = wpilib.buttons.JoystickButton(
            self.xboxController, 2)
        self.xboxYbutton = wpilib.buttons.JoystickButton(
            self.xboxController, 4)
        #self.navx = navx.AHRS.create_spi()
        # self.drive = drive.Drive(self.robotDrive, self.xboxController, self.navx)

        #Defining Variables
        self.dm = True
예제 #11
0
  def init(self):
    self.logger.info("DeepSpaceDrive::init()")
    self.timer = wpilib.Timer()
    self.timer.start()

    self.current_state = DriveState.OPERATOR_CONTROL

    self.pigeon = PigeonIMU(robotmap.PIGEON_IMU_CAN_ID)

    self.leftTalonMaster = ctre.WPI_TalonSRX(robotmap.DRIVE_LEFT_MASTER_CAN_ID)
    self.leftTalonSlave = ctre.WPI_TalonSRX(robotmap.DRIVE_LEFT_SLAVE_CAN_ID)

    self.rightTalonMaster = ctre.WPI_TalonSRX(robotmap.DRIVE_RIGHT_MASTER_CAN_ID)
    self.rightTalonSlave = ctre.WPI_TalonSRX(robotmap.DRIVE_RIGHT_SLAVE_CAN_ID)

    self.dummyTalon = ctre.TalonSRX(robotmap.CLAW_LEFT_WHEELS_CAN_ID)

    self.talons = [self.leftTalonMaster, self.leftTalonSlave, self.rightTalonMaster, self.rightTalonSlave]
    self.masterTalons = [self.leftTalonMaster, self.rightTalonMaster]

    self.drive = wpilib.RobotDrive(self.leftTalonMaster, self.rightTalonMaster)
    self.drive.setSafetyEnabled(False)

    self.drive_front_extend = wpilib.Solenoid(robotmap.PCM1_CANID, robotmap.DRIVE_FRONT_EXTEND_SOLENOID)
    self.drive_front_retract = wpilib.Solenoid(robotmap.PCM1_CANID, robotmap.DRIVE_FRONT_RETRACT_SOLENOID)
    self.drive_back_extend = wpilib.Solenoid(robotmap.PCM1_CANID, robotmap.DRIVE_REAR_EXTEND_SOLENOID)
    self.drive_back_retract = wpilib.Solenoid(robotmap.PCM1_CANID, robotmap.DRIVE_REAR_RETRACT_SOLENOID)
예제 #12
0
    def robotInit(self):
        """
        This function is called upon program startup and
        should be used for any initialization code.
        """
        # Configure shooter motor controller.
        self.shooter = ctre.CANTalon(1)  # Create a CANTalon object.
        self.shooter.setFeedbackDevice(
            ctre.CANTalon.FeedbackDevice.QuadEncoder
        )  # Choose an encoder as a feedback device.  The default should be QuadEncoder already, but might as well make sure.
        # I thought the encoder was 20 pulses per revolution per phase, which would require "80" as an argument below, but after trying it, it looks like there are 12.
        # Setting this parameter changes things so getPosition() returns decimal revolutions, and getSpeed() returns RPM.
        self.shooter.configEncoderCodesPerRev(48)
        # resets shooter position on startup
        self.shooter.setPosition(0)
        self.shooter.enableBrakeMode(
            False)  # This should change between brake and coast modes.

        self.l_motor = ctre.CANTalon(2)
        self.l_motor.setInverted(True)
        self.r_motor = ctre.CANTalon(3)
        self.r_motor.setInverted(True)
        self.stick = wpilib.Joystick(0)
        self.drive = wpilib.RobotDrive(self.l_motor, self.r_motor)
        self.counter = 0
예제 #13
0
 def robotInit(self):
     """
     This function is called upon program startup and
     should be used for any initialization code.
     """
     self.robot_drive = wpilib.RobotDrive(0,1)
     self.stick = wpilib.Joystick(1)
예제 #14
0
    def __init__(self):
        """
        Instantiates the motor objects.
        """

        super().__init__('Motors')

        # main motors
        self.left_motor = ctre.CANTalon(robotmap.motors.left_id)
        self.left_motor.setControlMode(ctre.CANTalon.ControlMode.Speed)
        self.left_motor.setFeedbackDevice(
            ctre.CANTalon.FeedbackDevice.QuadEncoder)
        self.left_motor.setInverted(False)
        self.right_motor = ctre.CANTalon(robotmap.motors.right_id)
        self.right_motor.setControlMode(ctre.CANTalon.ControlMode.Speed)
        self.right_motor.setFeedbackDevice(
            ctre.CANTalon.FeedbackDevice.QuadEncoder)
        self.right_motor.setInverted(False)

        self.sd = NetworkTables.getTable("SmartDashboard")
        self.sd.putNumber("direction", 1)

        # follower motors
        left_motor_follower = ctre.CANTalon(robotmap.motors.left_follower_id)
        left_motor_follower.setControlMode(ctre.CANTalon.ControlMode.Follower)
        left_motor_follower.set(robotmap.motors.left_id)
        right_motor_follower = ctre.CANTalon(robotmap.motors.right_follower_id)
        right_motor_follower.setControlMode(ctre.CANTalon.ControlMode.Follower)
        right_motor_follower.set(robotmap.motors.right_id)

        self.robot_drive = wpilib.RobotDrive(self.left_motor, self.right_motor)
        self.max_speed = 1760  # maximum edges per 100 ms, approx. 27 ft/s
        self.robot_drive.setMaxOutput(
            self.max_speed)  # maximum edges per 10ms, approx. 27 ft/s
예제 #15
0
 def robotInit(self):
     # Channels for the wheels
     frontLeftChannel    = 2
     rearLeftChannel     = 3
     frontRightChannel   = 1
     rearRightChannel    = 0
     
     self.myRobot = wpilib.RobotDrive(frontLeftChannel, rearLeftChannel,
                                      frontRightChannel, rearRightChannel)
     self.myRobot.setExpiration(0.1)
     self.stick = wpilib.Joystick(0)
     
     #
     # Communicate w/navX MXP via the MXP SPI Bus.
     # - Alternatively, use the i2c bus.
     # See http://navx-mxp.kauailabs.com/guidance/selecting-an-interface/ for details
     #
     
     self.ahrs = AHRS.create_spi()
     #self.ahrs = AHRS.create_i2c()
     
     turnController = wpilib.PIDController(self.kP, self.kI, self.kD, self.kF, self.ahrs, output=self)
     turnController.setInputRange(-180.0,  180.0)
     turnController.setOutputRange(-1.0, 1.0)
     turnController.setAbsoluteTolerance(self.kToleranceDegrees)
     turnController.setContinuous(True)
     
     self.turnController = turnController
     
     # Add the PID Controller to the Test-mode dashboard, allowing manual  */
     # tuning of the Turn Controller's P, I and D coefficients.            */
     # Typically, only the P value needs to be modified.                   */
     wpilib.LiveWindow.addActuator("DriveSystem", "RotateController", turnController)
예제 #16
0
파일: robot.py 프로젝트: virtuald/examples
    def robotInit(self):
        '''Robot initialization function'''
        gyroChannel = 0  #analog input

        self.joystickChannel = 0  #usb number in DriverStation

        #channels for motors
        self.leftMotorChannel = 1
        self.rightMotorChannel = 0
        self.leftRearMotorChannel = 3
        self.rightRearMotorChannel = 2

        self.angleSetpoint = 0.0
        self.pGain = 1  #propotional turning constant

        #gyro calibration constant, may need to be adjusted
        #gyro value of 360 is set to correspond to one full revolution
        self.voltsPerDegreePerSecond = .0128

        self.myRobot = wpilib.RobotDrive(
            wpilib.Talon(self.leftMotorChannel),
            wpilib.Talon(self.leftRearMotorChannel),
            wpilib.Talon(self.rightMotorChannel),
            wpilib.Talon(self.rightRearMotorChannel))

        self.gyro = wpilib.AnalogGyro(gyroChannel)
        self.joystick = wpilib.Joystick(self.joystickChannel)
예제 #17
0
    def __init__(self):
        super().__init__()
        self.talon_left = wpilib.Talon(0)
        self.talon_right = wpilib.Talon(1)
        self.drive = wpilib.RobotDrive(self.talon_left, self.talon_right)
        self.drive.setInvertedMotor(wpilib.RobotDrive.MotorType.kRearLeft,
                                    False)
        self.drive.setInvertedMotor(wpilib.RobotDrive.MotorType.kRearRight,
                                    True)
        self.joystick = wpilib.Joystick(0)

        self.width = 2
        self.top_speed = 15

        self.teleop = lambda: False

        dashboard2.graph("Forward", self.joystick.getY)
        dashboard2.graph("Turn", self.joystick.getX)
        dashboard2.graph("Talon Left", self.talon_left.get)
        dashboard2.graph("Talon Right", self.talon_right.get)
        dashboard2.chooser("Drive", ["Radius", "Arcade"])
        dashboard2.indicator("Teleop", self.teleop)
        simulbot.load(self.width, self.top_speed)

        self.time = 0

        dashboard2.run()
예제 #18
0
    def robotInit(self):
        '''Robot initialization function - Define your inputs, and what channels they connect to'''

        self.robotDrive = wpilib.RobotDrive(self.frontLeftChannel,
                                            self.rearLeftChannel,
                                            self.frontRightChannel,
                                            self.rearRightChannel)
            
        self.robotDrive.setExpiration(0.1)

        self.robotDrive.setInvertedMotor(RobotDrive.MotorType.kFrontLeft, True)

        self.robotDrive.setInvertedMotor(RobotDrive.MotorType.kRearLeft, True)

        self.winch_motor2 = wpilib.Talon(self.winchMotor2)
        self.winch_motor1 = wpilib.Talon(self.winchMotor1)
        
        self.stick = wpilib.Joystick(self.joystickChannel)
        
        self.fire_single_piston = wpilib.buttons.JoystickButton(self.stick, 1)
        self.fire_double_forward = wpilib.buttons.JoystickButton(self.stick, 2)
        self.fire_double_backward = wpilib.buttons.JoystickButton(self.stick, 3)
    
        self.single_solenoid = wpilib.Solenoid(1)
        self.double_solenoid = wpilib.DoubleSolenoid(2,3)
예제 #19
0
    def robotInit(self):
        self.robot_drive = wpilib.RobotDrive(5,6)
        self.stick1 = wpilib.Joystick(0)

        self.motor1 = ctre.WPI_TalonSRX(1) # Initialize the TalonSRX on device 1.
        self.motor2 = ctre.WPI_TalonSRX(2)
        self.motor3 = ctre.WPI_TalonSRX(3)
        self.motor4 = ctre.WPI_TalonSRX(4)
예제 #20
0
    def robotInit(self):

        self.LeftMec = wpilib.Talon(0)
        self.RightMec = wpilib.Talon(1)
        self.robotDrive = wpilib.RobotDrive(self.LeftMec, self.RightMec)
        self.pg = wpilib.Talon(2)
        self.xboxController = wpilib.XboxController(
            0)  # <-- This is for using Xbox controllers
예제 #21
0
 def robotInit(self):
     """
     This function is called upon program startup and
     should be used for any initialization code.
     """
     self.robot_drive = wpilib.RobotDrive(
         0, 1, motorController=minibot.MinibotMotorController)
     self.stick = minibot.Joystick(0)
예제 #22
0
 def __init__(self, robot, name=None):
     '''Initialize'''
     super().__init__(name=name)
     self.robot = robot
     self.gyro = wpilib.AnalogGyro(1)
     self.left_motor = wpilib.Jaguar(1)
     self.right_motor = wpilib.Jaguar(2)
     self.robot_drive = wpilib.RobotDrive(self.left_motor, self.right_motor)
예제 #23
0
 def robotInit(self):
     """
     This function is called upon program startup and
     should be used for any initialization code.
     """
     frontLeft = wpilib.Talon(0)
     frontRight = wpilib.Talon(1)
     self.robot_drive = wpilib.RobotDrive(frontLeft, frontRight)
     self.stick = wpilib.Joystick(1)
예제 #24
0
    def createObjects(self):
        self.robot_drive = wpilib.RobotDrive(0,
                                             1,
                                             2,
                                             3,
                                             motorController=CANTalon)

        self.drive_joystick = wpilib.Joystick(0)
        self.operator_joystick = wpilib.Joystick(1)
예제 #25
0
 def robotInit(self):
     self.motor = wpilib.CANTalon(1)
     self.motor = wpilib.CANTalon(2)
     self.motor = wpilib.CANTalon(3)
     self.motor = wpilib.CANTalon(4)
     
     self.motor.set(1)
     
     self.robot_drive = wpilib.RobotDrive(0,1)
예제 #26
0
    def robotInit(self):
        """Robot initialization function"""

        # object that handles basic drive operations
        self.myRobot = wpilib.RobotDrive(0, 1)
        self.myRobot.setExpiration(0.1)

        # joystick #0
        self.stick = wpilib.Joystick(0)
예제 #27
0
 def robotInit(self):  #This is a function or method
     """
     This function is called upon program startup and
     should be used for any initialization code.
     """
     self.robot_drive = wpilib.RobotDrive(5, 6)
     self.stick = wpilib.Joystick(0)
     self.Motor1 = wpilib.VictorSP(0)
     self.Motor2 = wpilib.VictorSP(1)
예제 #28
0
 def robotInit(self):
     global stick, drive, gyro, highGear
     stick = wpilib.Joystick(1)
     drive = wpilib.RobotDrive((wpilib.CANTalon(0)), (wpilib.CANTalon(2)),
                               (wpilib.CANTalon(1)), (wpilib.CANTalon(3)))
     drive.setInvertedMotor(wpilib.RobotDrive.MotorType.kFrontLeft, True)
     drive.setInvertedMotor(wpilib.RobotDrive.MotorType.kRearLeft, True)
     gyro = wpilib.Gyro(0)
     highGear = wpilib.DoubleSolenoid(0, 1)
예제 #29
0
    def robotInit(self):
        '''Robot initialization function'''

        # object that handles basic drive operations
        self.myRobot = wpilib.RobotDrive(0, 1)
        self.myRobot.setExpiration(0.1)

        # joysticks 1 & 2 on the driver station
        self.leftStick = wpilib.Joystick(0)
        self.rightStick = wpilib.Joystick(1)
예제 #30
0
    def robotInit(self):
        """
        This function is called upon program startup and
        should be used for any initialization code.
        """

        self.robot_drive = wpilib.RobotDrive(0, 1, 2, 3)
        self.robot_drive.setExpiration(0.1)
        #self.stick = wpilib.XboxController(1)
        self.stick = wpilib.Joystick(1)