Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def createObjects(self):
self.driveStick = xbox_controller.XboxController(0)
# If the robot is a simulation
if MyRobot.isSimulation():
# Change motors to default jaguars
self.lf_motor = wpilib.Jaguar(1)
self.lr_motor = wpilib.Jaguar(2)
self.rf_motor = wpilib.Jaguar(3)
self.rr_motor = wpilib.Jaguar(4)
# Set up drive train
self.drive = wpilib.RobotDrive(self.lf_motor, self.lr_motor, self.rf_motor, self.rr_motor)
def createObjects(self):
self.driveStick = xbox_controller.XboxController(0)
# If the robot is a simulation
if MyRobot.isSimulation():
# Change motors to default jaguars
self.lf_motor = wpilib.Jaguar(1)
self.lr_motor = wpilib.Jaguar(2)
self.rf_motor = wpilib.Jaguar(3)
self.rr_motor = wpilib.Jaguar(4)
# Set up drive train
self.drive = wpilib.RobotDrive(self.lf_motor, self.lr_motor, self.rf_motor, self.rr_motor)
def robotInit(self):
'''Robot-wide initialization code should go here'''
self.lstick = wpilib.Joystick(0)
self.rstick = wpilib.Joystick(1)
self.l_motor = wpilib.Jaguar(1)
self.r_motor = wpilib.Jaguar(2)
# Position gets automatically updated as robot moves
self.gyro = wpilib.AnalogGyro(1)
self.robot_drive = wpilib.RobotDrive(self.l_motor, self.r_motor)
self.motor = wpilib.Jaguar(4)
self.limit1 = wpilib.DigitalInput(1)
self.limit2 = wpilib.DigitalInput(2)
self.position = wpilib.AnalogInput(2)
def robotInit(self):
'''Robot-wide initialization code should go here'''
self.lstick = wpilib.Joystick(0)
self.rstick = wpilib.Joystick(1)
self.lr_motor = wpilib.Jaguar(1)
self.rr_motor = wpilib.Jaguar(2)
self.lf_motor = wpilib.Jaguar(3)
self.rf_motor = wpilib.Jaguar(4)
self.robot_drive = wpilib.RobotDrive(self.lf_motor, self.lr_motor,
self.rf_motor, self.rr_motor)
# Position gets automatically updated as robot moves
self.gyro = wpilib.AnalogGyro(1)
def robotInit(self):
'''Robot-wide initialization code should go here'''
self.lstick = wpilib.Joystick(1)
self.motor = wpilib.Jaguar(3)
def robotInit(self):
'''Robot-wide initialization code should go here'''
self.lstick = wpilib.Joystick(0)
self.rstick = wpilib.Joystick(1)
self.lr_motor = wpilib.Jaguar(1)
self.rr_motor = wpilib.Jaguar(2)
self.lf_motor = wpilib.Jaguar(3)
self.rf_motor = wpilib.Jaguar(4)
self.robot_drive = wpilib.RobotDrive(self.lf_motor, self.lr_motor,
self.rf_motor, self.rr_motor)
# Position gets automatically updated as robot moves
self.gyro = wpilib.AnalogGyro(1)
def robotInit(self):
'''Robot-wide initialization code should go here'''
self.lstick = wpilib.Joystick(0)
self.rstick = wpilib.Joystick(1)
self.lr_motor = wpilib.Jaguar(1)
self.rr_motor = wpilib.Jaguar(2)
self.lf_motor = wpilib.Jaguar(3)
self.rf_motor = wpilib.Jaguar(4)
self.robot_drive = wpilib.RobotDrive(self.lf_motor, self.lr_motor,
self.rf_motor, self.rr_motor)
# Position gets automatically updated as robot moves
self.gyro = wpilib.AnalogGyro(1)
def robotInit(self):
'''Robot-wide initialization code should go here'''
self.lstick = wpilib.Joystick(0)
self.rstick = wpilib.Joystick(1)
self.l_motor = wpilib.Jaguar(1)
self.r_motor = wpilib.Jaguar(2)
# Position gets automatically updated as robot moves
self.gyro = wpilib.AnalogGyro(1)
self.robot_drive = wpilib.RobotDrive(self.l_motor, self.r_motor)
self.motor = wpilib.Jaguar(4)
self.limit1 = wpilib.DigitalInput(1)
self.limit2 = wpilib.DigitalInput(2)
self.position = wpilib.AnalogInput(2)
def robotInit(self):
'''Robot-wide initialization code should go here'''
self.lstick = wpilib.Joystick(0)
self.rstick = wpilib.Joystick(1)
self.lr_motor = wpilib.Jaguar(1)
self.rr_motor = wpilib.Jaguar(2)
self.lf_motor = wpilib.Jaguar(3)
self.rf_motor = wpilib.Jaguar(4)
self.robot_drive = wpilib.RobotDrive(self.lf_motor, self.lr_motor,
self.rf_motor, self.rr_motor)
# The output function of a mecanum drive robot is always
# +1 for all output wheels. However, traditionally wired
# robots will be -1 on the left, 1 on the right.
self.robot_drive.setInvertedMotor(wpilib.RobotDrive.MotorType.kFrontLeft, True)
self.robot_drive.setInvertedMotor(wpilib.RobotDrive.MotorType.kRearLeft, True)
# Position gets automatically updated as robot moves
self.gyro = wpilib.AnalogGyro(1)