def __init__(self): super().__init__("Mecanum") # motors and the channels they are connected to self.frontLeftMotor = wpilib.VictorSP(1) self.rearLeftMotor = wpilib.PWMVictorSPX(2) self.frontRightMotor = wpilib.VictorSP(0) self.rearRightMotor = wpilib.PWMVictorSPX(3) # invert the left side motors self.frontLeftMotor.setInverted(False) # you may need to change or remove this to match your robot self.rearLeftMotor.setInverted(False) self.rearRightMotor.setInverted(False) #added this to match motor self.drive = MecanumDrive( self.frontLeftMotor, self.rearLeftMotor, self.frontRightMotor, self.rearRightMotor, ) self.drive.setExpiration(0.1) self.drive.setSafetyEnabled(False)
def __init__(self): #Initialize Right motors right_front = (wpilib.VictorSP(0)) right_mid = (wpilib.VictorSP(1)) right_rear = (wpilib.VictorSP(2)) self.right_motor_group = wpilib.SpeedControllerGroup( right_front, right_mid, right_rear)
def robotInit(self): """Robot initialization function""" self.frontLeftMotor = wpilib.VictorSP(self.frontLeftChannel) self.rearLeftMotor = wpilib.VictorSP(self.rearLeftChannel) self.frontRightMotor = wpilib.VictorSP(self.frontRightChannel) self.rearRightMotor = wpilib.VictorSP(self.rearRightChannel) # invert the left side motors # self.frontLeftMotor.setInverted(True) # you may need to change or remove this to match your robot # self.rearLeftMotor.setInverted(True) # self.frontRightMotor.setInverted(True) # self.rearRightMotor.setInverted(True) self.drive = MecanumDrive( self.frontLeftMotor, self.rearLeftMotor, self.frontRightMotor, self.rearRightMotor, ) self.drive.setExpiration(0.1) self.xbox0 = wpilib.XboxController(self.xchannel0) self.xbox1 = wpilib.XboxController(self.xchannel1)
def __init__(self): #Initialize Left motors left_front = (wpilib.VictorSP(3)) left_mid = (wpilib.VictorSP(4)) left_rear = (wpilib.VictorSP(5)) self.left_motor_group = wpilib.SpeedControllerGroup( left_front, left_mid, left_rear)
def robotInit(self): self.left_drive_motors = wpilib.VictorSP(0) self.right_drive_motors = wpilib.VictorSP(1) self.arm_drive_motors = wpilib.VictorSP(2) self.left_joystick = wpilib.Joystick(0) self.right_joystick = wpilib.Joystick(1)
def robotInit(self): """ This function is called upon program startup and should be used for any initialization code. """ #Initialize Networktables self.sd = NetworkTables.getTable('SmartDashboard') #Set up motors to drive robot self.M2 = wpilib.VictorSP(2) self.M3 = wpilib.VictorSP(3) #self.M2.setInverted(True) #self.M3.setInverted(True) self.left = wpilib.SpeedControllerGroup(self.M2, self.M3) self.M0 = wpilib.VictorSP(0) self.M1 = wpilib.VictorSP(1) self.right = wpilib.SpeedControllerGroup(self.M0, self.M1) self.drive = wpilib.drive.DifferentialDrive(self.left, self.right) self.stick = wpilib.Joystick(1) self.timer = wpilib.Timer() #Camera wpilib.CameraServer.launch() #Servo self.SV1 = wpilib.Servo(9) self.SV2 = wpilib.Servo(8) #Dashboard NetworkTables.initialize(server='10.61.62.2') #Switches self.SW0 = wpilib.DigitalInput(0) self.SW1 = wpilib.DigitalInput(1) #Elevator self.E = wpilib.VictorSP(5) self.prepareCubeFlag = 0 self.grabCubeFlag = 0 self.deliverCubeFlag = 0 self.adjustLeftFlag = 0 self.adjustRightFlag = 0 self.driveFlag = 0 #Gyro self.gyro = wpilib.ADXRS450_Gyro(0) self.gyro.reset() #All possible autonomous routines in a sendable chooser ''' self.chooser = wpilib.SendableChooser() self.chooser.addDefault("None", '4') self.chooser.addObject("left-LeftScale", '1') self.chooser.addObject("Middle-LeftScale", '2') self.chooser.addObject("Right-LeftScale", '3') self.chooser.addObject("Left-RightScale", '5') ''' #wpilib.SmartDashboard.putData('Choice', self.chooser) #Encoders self.EC1 = wpilib.Encoder(2, 3) self.EC2 = wpilib.Encoder(4, 5) self.EC1.reset() self.EC2.reset()
def robotInit(self): """This function initiates the robot's components and parts""" # Here we create a function for the command class to return the robot # instance, so that we don't have to import the robot module for each # command. Command.getRobot = lambda _: self # This launches the camera server between the robot and the computer wpilib.CameraServer.launch() self.joystick = wpilib.Joystick(0) self.lr_motor = ctre.WPI_TalonSRX(1) self.lf_motor = ctre.WPI_TalonSRX(2) self.rr_motor = ctre.WPI_TalonSRX(5) self.rf_motor = ctre.WPI_TalonSRX(6) self.left = wpilib.SpeedControllerGroup(self.lf_motor, self.lr_motor) self.right = wpilib.SpeedControllerGroup(self.rf_motor, self.rr_motor) self.drivetrain_solenoid = wpilib.DoubleSolenoid(2, 3) self.drivetrain_gyro = wpilib.AnalogGyro(1) # Here we create the drivetrain as a whole, combining all the different # robot drivetrain compontents. self.drivetrain = drivetrain.Drivetrain(self.left, self.right, self.drivetrain_solenoid, self.drivetrain_gyro, self.rf_motor) self.l_gripper = wpilib.VictorSP(0) self.r_gripper = wpilib.VictorSP(1) self.grippers = grippers.Grippers(self.l_gripper, self.r_gripper) self.elevator_motor = wpilib.VictorSP(2) self.elevator_top_switch = wpilib.DigitalInput(4) self.elevator_bot_switch = wpilib.DigitalInput(5) self.elevator = elevator.Elevator(self.elevator_motor, self.elevator_top_switch, self.elevator_bot_switch) self.handles_solenoid = wpilib.DoubleSolenoid(0, 1) self.handles = handles.Handles(self.handles_solenoid) # This creates the instance of the autonomous program that will run # once the autonomous period begins. self.autonomous = AutonomousProgram() # This gets the instance of the joystick with the button function # programmed in. self.josytick = oi.getJoystick()
def __init__(self): '''Instantiates the claw object''' super().__init__('Claw') self.lastValue = 0 self.motorL = wpilib.VictorSP(RobotMap.claw.leftMotor) self.motorR = wpilib.VictorSP(RobotMap.claw.rightMotor) self.winchMotor = ctre.wpi_talonsrx.WPI_TalonSRX(RobotMap.claw.winchMotor)
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)
def robotInit(self): '''Robot initialization function''' self.motorFrontRight = wp.VictorSP(2) self.motorBackRight = wp.VictorSP(4) self.motorMiddleRight = wp.VictorSP(6) self.motorFrontLeft = wp.VictorSP(1) self.motorBackLeft = wp.VictorSP(3) self.motorMiddleLeft = wp.VictorSP(5) self.intakeMotor = wp.VictorSP(8) self.shootMotor1 = wp.VictorSP(7) self.shootMotor2 = wp.VictorSP(9) self.liftMotor = wp.VictorSP(0) self.gyro = wp.ADXRS450_Gyro(0) self.accel = wp.BuiltInAccelerometer() self.gearSensor = wp.DigitalInput(6) self.LED = wp.DigitalOutput(9) self.rightEncd = wp.Encoder(0, 1) self.leftEncd = wp.Encoder(2, 3) self.shootEncd = wp.Counter(4) self.compressor = wp.Compressor() self.shifter = wp.DoubleSolenoid(0, 1) self.ptoSol = wp.DoubleSolenoid(2, 3) self.kicker = wp.DoubleSolenoid(4, 5) self.gearFlap = wp.DoubleSolenoid(6, 7) self.stick = wp.Joystick(0) self.stick2 = wp.Joystick(1) self.stick3 = wp.Joystick(2) #Initial Dashboard Code wp.SmartDashboard.putNumber("Turn Left pos 1:", 11500) wp.SmartDashboard.putNumber("Lpos 2:", -57) wp.SmartDashboard.putNumber("Lpos 3:", 5000) wp.SmartDashboard.putNumber("stdist:", 6000) wp.SmartDashboard.putNumber("Turn Right pos 1:", 11500) wp.SmartDashboard.putNumber("Rpos 2:", 57) wp.SmartDashboard.putNumber("Rpos 3:", 5000) wp.SmartDashboard.putNumber("pos 4:", 39) wp.SmartDashboard.putNumber("-pos 4:", -39) wp.SmartDashboard.putNumber("Time", 5) wp.SmartDashboard.putBoolean("Shooting Auto", False) wp.SmartDashboard.putNumber("P", .08) wp.SmartDashboard.putNumber("I", 0.005) wp.SmartDashboard.putNumber("D", 0) wp.SmartDashboard.putNumber("FF", 0.85) self.chooser = wp.SendableChooser() self.chooser.addDefault("None", 4) self.chooser.addObject("Left Turn Auto", 1) self.chooser.addObject("Straight/Enc", 2) self.chooser.addObject("Right Turn Auto", 3) self.chooser.addObject("Straight/Timer", 5) self.chooser.addObject("Shoot ONLY", 6) wp.SmartDashboard.putData("Choice", self.chooser) wp.CameraServer.launch("vision.py:main")
def createObjects(self): # Define Driving Motors self.rightDrive = wpilib.VictorSP(0) self.leftDrive = wpilib.VictorSP(1) # Create Robot Drive self.robotDrive = wpilib.drive.DifferentialDrive( self.rightDrive, self.leftDrive) # Create Shifter Pneumatics self.shifterSolenoid = wpilib.DoubleSolenoid(0, 0, 1) # Joysticks and Controllers self.driveJoystick = wpilib.Joystick(0) self.driveController = XboxController(0) self.subsystemJoystick = wpilib.Joystick(1) self.subsystemController = XboxController(1) # Create NavX and Accel self.navX = navx.AHRS.create_spi() self.accel = wpilib.BuiltInAccelerometer() # Set Drivespeed self.driveSpeed = 0 # Intake Motors self.intakeMotor = wpilib.VictorSP(2) # Intake Lifter self.intakeLifter = wpilib.Spark(6) # Create Cube Intake Pneumatics self.intakeSolenoid = wpilib.Solenoid(0, 2) # Create Ramp Motors self.rightRamp = wpilib.Spark(5) self.leftRamp = wpilib.Spark(4) # Create Ramp Deploy Pneumatics self.rampSolenoid = wpilib.Solenoid(0, 3) # Create Timer (For Making Timed Events) self.timer = wpilib.Timer() # Initialize Compressor self.compressor = wpilib.Compressor() # Create CameraServer wpilib.CameraServer.launch("common/multipleCameras.py:main") # Set Gear in Dashboard wpilib.SmartDashboard.putString("Shift State", "Low Gear") wpilib.SmartDashboard.putString("Cube State", "Unclamped")
def __init__(self): super().__init__('Intake') self.intake_motor_closeOpen = wpilib.VictorSP( 6 ) #insert motor/control number, ie one of the low voltage input numbers self.intake_motor_rightWheel = wpilib.VictorSP( 7 ) #insert motor/control number, ie one of the low voltage input numbers self.intake_motor_leftWheel = wpilib.VictorSP( 8 ) #insert motor/control number, ie one of the low voltage input numbers
def robotInit(self): """ This function is called upon program startup and should be used for any initialization code. """ self.left_motor = wpilib.VictorSP(0) self.right_motor = wpilib.VictorSP(1) self.drive = wpilib.drive.DifferentialDrive(self.left_motor, self.right_motor) self.drive.setRightSideInverted(True) self.stick = wpilib.Joystick(0) self.timer = wpilib.Timer()
def __init__(self): super().__init__('Intake') self.intake_motor_closeOpen = wpilib.VictorSP(8) self.intake_motor_rightWheel = wpilib.VictorSP(9) self.intake_motor_leftWheel = wpilib.VictorSP(7) self.limit_switch = wpilib.DigitalOutput(0) self.pdp = wpilib.PowerDistributionPanel(16) self.intake_table = networktables.NetworkTables.getTable('/Intake') self.timer = wpilib.Timer() self.timer.start() self.logger = None
def robotInit(self): '''Robot-wide initialization code should go here''' self.lstick = wpilib.Joystick self.motor_D1 = wpilib.VictorSP(3) self.motor_I1 = wpilib.VictorSP(4) self.motor_externo=wpilib.VictorSP(5) self.G_motor=SpeedControllerGroup(self.motor_D1, self.motor_I1) #motor_D1 y motor_D2 son los motores de la caja de reducción self.finalCarrera1=wpilib.digitalInput(1) self.finalCarrera2=wpilib.digitalInput(2)
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.stick = wpilib.Joystick(0) self.Motor1 = wpilib.VictorSP(4) self.Motor2 = wpilib.VictorSP(5) self.Switch1 = wpilib.DigitalInput(0) self.Switch2 = wpilib.DigitalInput(1) self.Servo1 = wpilib.Servo(6) self.Servo2 = wpilib.Servo(7)
def __init__( self, robot ): super( ).__init__( 'ground feeder' ) self.robot = robot #if you feel that this should be 0 and 1, because programmers count from 0 then too bad. self.feeder_motor_1 = wpilib.VictorSP( const.ID_FEEDER_MOTOR_1 ) self.feeder_motor_2 = wpilib.VictorSP( const.ID_FEEDER_MOTOR_2 ) self.feeder_motor_2.setInverted( True ) self.feeder_solenoid_1 = wpilib.Solenoid( const.ID_PCM_1, const.ID_FEEDER_SOLENOID_1 ) self.feeder_solenoid_2 = wpilib.Solenoid( const.ID_PCM_1, const.ID_FEEDER_SOLENOID_2 ) self.feeder_running = const.ID_FEEDER_STOPPED self.feeder_solenoid_state = const.ID_FEEDER_ENGAGED
def robotInit(self): """ This function is called upon program startup and should be used for any initialization code. """ self.table = NetworkTables.getTable("SmartDashboard") self.robot_drive = wpilib.drive.DifferentialDrive( wpilib.Spark(0), wpilib.Spark(1)) self.stick = wpilib.Joystick(0) self.elevatorMotor = wpilib.VictorSP(5) self.intakeMotor = wpilib.VictorSP(2) self.intakeMotorLeft = wpilib.VictorSP(3) self.intakeMotorRight = wpilib.VictorSP(4) self.climbMotor = wpilib.VictorSP(6) self.ahrs = AHRS.create_i2c(0) #self.gearSpeed = .5 #self.lights = wpilib.Relay(1) #self.lightToggle = False #self.lightToggleBool = True #self.togglev = 0 self.robot_drive.setSafetyEnabled(False) wpilib.CameraServer.launch() self.xb = wpilib.Joystick(1) self.Compressor = wpilib.Compressor(0) self.Compressor.setClosedLoopControl(True) self.enabled = self.Compressor.enabled() self.PSV = self.Compressor.getPressureSwitchValue() self.LeftSolenoid = wpilib.DoubleSolenoid(0, 1) self.RightSolenoid = wpilib.DoubleSolenoid(2, 3) self.Compressor.start() self.wheel = wpilib.Encoder(0, 1) self.wheel2 = wpilib.Encoder(2, 3, True) self.encoder = Sensors.Encode(self.wheel, self.wheel2) #wpilib.CameraServer.launch() self.ultrasonic = wpilib.AnalogInput(0) self.autoSchedule = Auto.Auto(self, ) self.intakeToggle = False self.intakePos = False self.openSwitch = wpilib.DigitalInput(9) self.closedSwitch = wpilib.DigitalInput(8) self.speed = 0.6 self.leftSpeed = 0.7 self.rightSpeed = 0.7 self.speedToggle = False
def __init__(self): #Initialize Left motors # Two motors cause TuffBox # Also 0 is generally reserved for PDP or something left_one = (wpilib.PWMVictorSPX(3)) left_two = (wpilib.VictorSP(6)) self.left_motor_group = wpilib.SpeedControllerGroup(left_one, left_two)
def __init__(self, robot): super().__init__() self.robot = robot self.left = wpilib.VictorSP(0) self.right = wpilib.VictorSP(1) """Motors used for driving""" self.drive = wpilib.DifferentialDrive(self.left, self.right) """DifferentialDrive is the main object that deals with driving""" self.left_encoder = wpilib.Encoder(1, 2) self.right_encoder = wpilib.Encoder(3, 4) # Encoders may measure differently in the real world and in # simulation. In this example the robot moves 0.042 barleycorns # per tick in the real world, but the simulated encoders # simulate 360 tick encoders. This if statement allows for the # real robot to handle this difference in devices. if robot.isReal(): self.left_encoder.setDistancePerPulse(0.042) self.right_encoder.setDistancePerPulse(0.042) else: # Circumference in ft = 4in/12(in/ft)*PI self.left_encoder.setDistancePerPulse((4.0 / 12.0 * math.pi) / 360.0) self.right_encoder.setDistancePerPulse((4.0 / 12.0 * math.pi) / 360.0) self.rangefinder = wpilib.AnalogInput(6) self.gyro = wpilib.AnalogGyro(1) wpilib.LiveWindow.addActuator( "Drive Train", "Front_Left Motor", self.front_left_motor ) wpilib.LiveWindow.addActuator( "Drive Train", "Back Left Motor", self.back_left_motor ) wpilib.LiveWindow.addActuator( "Drive Train", "Front Right Motor", self.front_right_motor ) wpilib.LiveWindow.addActuator( "Drive Train", "Back Right Motor", self.back_right_motor ) wpilib.LiveWindow.addSensor("Drive Train", "Left Encoder", self.left_encoder) wpilib.LiveWindow.addSensor("Drive Train", "Right Encoder", self.right_encoder) wpilib.LiveWindow.addSensor("Drive Train", "Rangefinder", self.rangefinder) wpilib.LiveWindow.addSensor("Drive Train", "Gyro", self.gyro)
def __init__(self, robot): ''' Command Dependencies: All values currently arbitary! ''' super().__init__("winch") self.winch_motor = wpilib.VictorSP(5)
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(0,1,2,3) self.stick = wpilib.Joystick(0) self.Motor1 = wpilib.VictorSP(4) self.Motor2 = wpilib.VictorSP(5) self.Switch1 = wpilib.DigitalInput(0) self.Switch2 = wpilib.DigitalInput(1) self.Servo1 = wpilib.Servo(6) self.Servo2 = wpilib.Servo(7) self.camera1 = wpilib.CameraServer.launch('vision.py:main') NetworkTables.initialize(server='10.61.62.2') sd = NetworkTables.getTable('SmartDashboard') sd.putNumber('someNumber', 1234)
def createObjects(self): self.lr_motor = ctre.WPI_TalonSRX(1) self.lf_motor = ctre.WPI_TalonSRX(2) self.rr_motor = ctre.WPI_TalonSRX(5) self.rf_motor = ctre.WPI_TalonSRX(6) self.rf_motor.configSelectedFeedbackSensor( ctre.WPI_TalonSRX.FeedbackDevice.CTRE_MagEncoder_Relative) self.talon.setSensorPhase(True) self.setOutputRange(self.MIN_SPEED, self.MAX_SPEED) self.setAbsoluteTolerance(self.ABS_TOLERANCE) self.ABS_TOLERANCE = (3 / self.DIST_TO_TICKS) self.left = wpilib.SpeedControllerGroup(self.lf_motor, self.lr_motor) self.right = wpilib.SpeedControllerGroup(self.rf_motor, self.rr_motor) self.drive = wpilib.drive.DifferentialDrive(self.left, self.right) self.drivetrain_solenoid = wpilib.DoubleSolenoid(2, 3) self.drivetrain_gyro = wpilib.AnalogGyro(1) self.elevator_motor = wpilib.VictorSP(2) self.top_switch = wpilib.DigitalInput(4) self.bot_switch = wpilib.DigitalInput(5) self.handles_solenoid = wpilib.DoubleSolenoid(0, 1) self.l_gripper_motor = wpilib.VictorSP(0) self.r_gripper_motor = wpilib.VictorSP(1) self.joystick = wpilib.Joystick(0) self.trigger = wpilib.buttons.JoystickButton(self.joystick, 1) self.button_2 = wpilib.buttons.JoystickButton(self.joystick, 2) self.button_3 = wpilib.buttons.JoystickButton(self.joystick, 3) self.button_4 = wpilib.buttons.JoystickButton(self.joystick, 4) self.button_5 = wpilib.buttons.JoystickButton(self.joystick, 5) self.button_7 = wpilib.buttons.JoystickButton(self.joystick, 7) self.button_10 = wpilib.buttons.JoystickButton(self.joystick, 10) self.button_11 = wpilib.buttons.JoystickButton(self.joystick, 11)
def __init__(self, robot): super().__init__('agitator') self.robot = robot # The climber has two motors, but they are connected to one pwm because of a y cable self.agitator_motor_1 = wpilib.VictorSP(const.ID_AGITATOR_MOTOR_1) self.agitator_motor_1.setInverted(True) #true on practice robot self.speed = 0
def robotInit(self): """Init is called once when the robot is turned on.""" self.efacing = 1 """efacing is used to invert our controls.""" self.CarEncoder = wpilib.Encoder(0, 1) #self.HatchEncoder = wpilib.Encoder(3, 4) self.chooser = wpilib.SendableChooser() self.chooser.addObject('cargo', '1') self.chooser.addObject('hatch panel', '2') self.left = wpilib.VictorSP(0) self.right = wpilib.VictorSP(1) """Motors used for driving""" self.myRobot = DifferentialDrive(self.left, self.right) """DifferentialDrive is the main object that deals with driving""" self.RotServo = wpilib.Servo(2) self.TiltServo = wpilib.Servo(3) """Our two servos will rotate (RotServo) and tilt (TiltServo) our vision cameras.""" self.motor1 = wpilib.Talon(5) self.motor2 = wpilib.Talon(6) """I mostly just added these motor controllers anticipating some sort of intake system that uses motors.""" self.Punch = wpilib.DoubleSolenoid(0, 1) self.DPunch = wpilib.DoubleSolenoid(3, 2) """The punching mechanism for removal of the hatch panels can use a DoubleSolenoid or regular Solenoid. The Solenoid only needs the channel it's plugged into (4) whereas the Double Solenoid needs the module number, forward channel number, and reverse channel order in that order.""" self.XBox0 = wpilib.XboxController(0) self.XBox1 = wpilib.XboxController(1) """Xbox controllers 1 and 2 on the driver station.""" self.myRobot.setExpiration(0.1) """If communication is cut off between the driver station and the robot
def __init__(self, robot): ''' Command Dependencies: All values currently arbitary! ''' super().__init__("carrier") # CARRIER is 5 self.carrier_motor = wpilib.VictorSP(5)
def robotInit(self): """ This function is called upon program startup and should be used for any initialization code. """ self.E1 = wpilib.VictorSP(0) #Left Elevator Motor self.E2 = wpilib.VictorSP(1) #Right Elevatror Motor self.S1 = wpilib.VictorSP(2) #Left Shoulder Motor self.S2 = wpilib.VictorSP(3) #Right Shoulder Motor self.M0 = ctre.wpi_talonsrx.WPI_TalonSRX(4) self.M1 = ctre.wpi_talonsrx.WPI_TalonSRX(3) self.M0.setInverted(True) self.M1.setInverted(True) self.left = wpilib.SpeedControllerGroup(self.M0,self.M1) self.M2 = ctre.wpi_talonsrx.WPI_TalonSRX(2) self.M3 = ctre.wpi_talonsrx.WPI_TalonSRX(1) self.right = wpilib.SpeedControllerGroup(self.M2, self.M3) self.drive = wpilib.drive.DifferentialDrive(self.left,self.right) self.stick = wpilib.Joystick(0) self.timer = wpilib.Timer()
def __init__(self, motors, maxSpeed=1, inverted=False): ''' Constructor ''' self.motorArr = [] self.max = maxSpeed self.inverted = inverted self.useGyro = False for motor in motors: self.motorArr.append(wpilib.VictorSP(motor))
def robotInit(self): """ This function is called upon program startup and should be used for any initialization code. """ #Set up motors to drive robot self.M2 = wpilib.VictorSP(2) self.M3 = wpilib.VictorSP(3) #self.M2.setInverted(True) #self.M3.setInverted(True) self.left = wpilib.SpeedControllerGroup(self.M2,self.M3) self.M0 = wpilib.VictorSP(0) self.M1 = wpilib.VictorSP(1) self.right = wpilib.SpeedControllerGroup(self.M0,self.M1) self.drive = wpilib.drive.DifferentialDrive(self.left, self.right) self.stick = wpilib.Joystick(0) self.timer = wpilib.Timer()
def __init__(self, robot): print("init") super().__init__() self.robot = robot ''' Command Dependencies: Cargo Intake/Eject Initialize Motor[cargo intake] Cargo is instantiated by an "intake" and "eject" command ''' self.cargo_motor = wpilib.VictorSP(6)