本文整理匯總了Java中edu.wpi.first.wpilibj.RobotDrive.setInvertedMotor方法的典型用法代碼示例。如果您正苦於以下問題:Java RobotDrive.setInvertedMotor方法的具體用法?Java RobotDrive.setInvertedMotor怎麽用?Java RobotDrive.setInvertedMotor使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類edu.wpi.first.wpilibj.RobotDrive
的用法示例。
在下文中一共展示了RobotDrive.setInvertedMotor方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: initialize
import edu.wpi.first.wpilibj.RobotDrive; //導入方法依賴的package包/類
public static void initialize()
{
if (!initialized) {
mFrontLeft = new CANTalon(LEFT_FRONT_TALON_ID);
mBackLeft = new CANTalon(LEFT_REAR_TALON_ID);
mFrontRight = new CANTalon(RIGHT_FRONT_TALON_ID);
mBackRight = new CANTalon(RIGHT_REAR_TALON_ID);
drive = new RobotDrive(mFrontLeft, mBackLeft, mFrontRight, mBackRight);
drive.setInvertedMotor(RobotDrive.MotorType.kFrontLeft, false);
drive.setInvertedMotor(RobotDrive.MotorType.kFrontRight, false);
drive.setInvertedMotor(RobotDrive.MotorType.kRearLeft, false);
drive.setInvertedMotor(RobotDrive.MotorType.kRearRight, false);
leftStick = new Joystick(LEFT_JOYSTICK_ID);
rightStick = new Joystick(RIGHT_JOYSTICK_ID);
initialized = true;
}
}
示例2: DrivePart
import edu.wpi.first.wpilibj.RobotDrive; //導入方法依賴的package包/類
public DrivePart(BotRunner runner){
super(runner);
bot = runner;
shotRange = 90;
highRange = 60;
lowRange = 30;
autoTime = new Timer();
frontRight = new Jaguar(1);
frontLeft = new Jaguar(2);
backRight = new Jaguar(3);
backLeft = new Jaguar(4);
roboDrive = new RobotDrive(frontLeft, backLeft, frontRight, backRight);
roboDrive.setInvertedMotor(RobotDrive.MotorType.kRearRight, true);
roboDrive.setInvertedMotor(RobotDrive.MotorType.kFrontLeft, true);
}
示例3: Drive
import edu.wpi.first.wpilibj.RobotDrive; //導入方法依賴的package包/類
private Drive()
{
drive = new RobotDrive(new Talon(1),new Talon(2),new Talon(3),new Talon(4));
drive.setSafetyEnabled(false);
e1 = new Encoder(RobotMap.ENCODER_1_A, RobotMap.ENCODER_1_B, false, CounterBase.EncodingType.k4X);
e2 = new Encoder(RobotMap.ENCODER_2_A, RobotMap.ENCODER_2_B, false, CounterBase.EncodingType.k4X);
//A calculated constant to convert from encoder ticks to feet on 4 inch diameter wheels
e1.setDistancePerPulse(0.0349065850388889/12);
e2.setDistancePerPulse(0.0349065850388889/12);
startEncoders();
drive.setInvertedMotor(RobotDrive.MotorType.kFrontLeft, true);
drive.setInvertedMotor(RobotDrive.MotorType.kRearLeft, true);
sonic = new Ultrasonic(RobotMap.ULTRASONIC_A, RobotMap.ULTRASONIC_B);
sonic.setAutomaticMode(true);
sonic.setEnabled(true);
shifter = new DoubleSolenoid(RobotMap.SHIFTER_ENGAGE, RobotMap.SHIFTER_DISENGAGE);
}
示例4: robotInit
import edu.wpi.first.wpilibj.RobotDrive; //導入方法依賴的package包/類
public void robotInit() {
frontLeft = new VictorSP(0);
backLeft = new VictorSP(1);
frontRight = new VictorSP(2);
backRight = new VictorSP(3);
intakeMotor = new VictorSP(4);
compressor = new Compressor(0);
intakeSolenoid = new Solenoid(0);
driveTrain = new RobotDrive(frontLeft, backLeft, frontRight, backRight);
driveTrain.setSafetyEnabled(false);
driveTrain.setExpiration(0.1);
driveTrain.setSensitivity(0.5);
driveTrain.setInvertedMotor(RobotDrive.MotorType.kFrontLeft, false);
driveTrain.setInvertedMotor(RobotDrive.MotorType.kRearLeft, false);
driveTrain.setInvertedMotor(RobotDrive.MotorType.kFrontRight, false);
driveTrain.setInvertedMotor(RobotDrive.MotorType.kRearRight, false);
XboxController = new Joystick(2);
rightJoystick = new Joystick(1);
leftJoystick = new Joystick(0);
}
示例5: Robot
import edu.wpi.first.wpilibj.RobotDrive; //導入方法依賴的package包/類
public Robot() {
//make objects for drive train, joystick, and gyro
myRobot = new RobotDrive(new CANTalon(leftMotorChannel), new CANTalon(leftRearMotorChannel),
new CANTalon(rightMotorChannel), new CANTalon(rightRearMotorChannel));
myRobot.setInvertedMotor(MotorType.kFrontLeft, true); // invert the left side motors
myRobot.setInvertedMotor(MotorType.kRearLeft, true); // you may need to change or remove this to match your robot
joystick = new Joystick(0);
gyro = new AnalogGyro(gyroChannel);
}
示例6: DriveTrain
import edu.wpi.first.wpilibj.RobotDrive; //導入方法依賴的package包/類
public DriveTrain(){
drive = new RobotDrive(driveFrontLeft, driveBackLeft, driveFrontRight, driveBackRight);
isCubic = true; // set to true so we can test it with it on
drive.setInvertedMotor(RobotDrive.MotorType.kFrontLeft, true); // Inverts the motor because it is facing the other direction
drive.setInvertedMotor(RobotDrive.MotorType.kRearRight, true); // Inverts the motor because it is facing the other direction
drive.setInvertedMotor(RobotDrive.MotorType.kFrontRight, true); // Inverts the motor because it is facing the other direction
gyro.reset(); //Resets gyro once so field relative has one 'true' North direction
}
示例7: init
import edu.wpi.first.wpilibj.RobotDrive; //導入方法依賴的package包/類
public static void init() {
leftDriveMotor = new Talon(leftDriveMotorPin);
LiveWindow.addActuator("driveTrain", "Left Motor",
(Talon) leftDriveMotor);
rightDriveMotor = new Talon(rightDriveMotorPin);
LiveWindow.addActuator("driveTrain", "Right Motor",
(Talon) rightDriveMotor);
shifterSolenoid = new DoubleSolenoid(shifterSolenoidUpPin, shifterSolenoidDownPin);
LiveWindow.addActuator("driveTrain", "Gearbox Shifter",
(DoubleSolenoid) shifterSolenoid);
winchMotor = new Talon(winchMotorPin);
LiveWindow.addActuator("chainLifter", "Elevator Motor",
(Talon) winchMotor);
robotDrive = new RobotDrive(leftDriveMotor, rightDriveMotor);
robotDrive.setSafetyEnabled(true);
robotDrive.setExpiration(0.1);
robotDrive.setSensitivity(0.5);
robotDrive.setMaxOutput(1.0);
robotDrive.setInvertedMotor(RobotDrive.MotorType.kRearLeft, false);
robotDrive.setInvertedMotor(RobotDrive.MotorType.kRearRight, false);
grabberSolenoid = new DoubleSolenoid(grabberSolenoidOpenPin, grabberSolenoidClosePin);
LiveWindow.addActuator("grabberArm", "Grabber Solenoid",
(DoubleSolenoid) grabberSolenoid);
compressor = new Compressor();
LiveWindow.addActuator("grabberArm", "compressor",
(Compressor) compressor);
}
示例8: initialize
import edu.wpi.first.wpilibj.RobotDrive; //導入方法依賴的package包/類
@Override
public void initialize() {
m_robot = new RobotDrive(RobotMap.FRONT_LEFT_MOTOR, RobotMap.REAR_LEFT_MOTOR,
RobotMap.FRONT_RIGHT_MOTOR, RobotMap.REAR_RIGHT_MOTOR);
m_robot.setExpiration(RobotDrive.kDefaultExpirationTime); // set expiration time for motor movement if error occurs
m_robot.setSafetyEnabled(true); // enable safety so motors don't burn out
m_robot.setInvertedMotor(MotorType.kFrontRight, true);
//m_robot.setInvertedMotor(MotorType.kFrontLeft, true);
m_robot.setInvertedMotor(MotorType.kRearRight, true);
//m_robot.setInvertedMotor(MotorType.kRearLeft, true);
}
示例9: robotInit
import edu.wpi.first.wpilibj.RobotDrive; //導入方法依賴的package包/類
public void robotInit(){
driveStick= new JoyStickCustom(1, DEADZONE);
secondStick=new JoyStickCustom(2, DEADZONE);
frontLeft= new Talon(1);
rearLeft= new Talon(2);
frontRight= new Talon(3);
rearRight= new Talon(4);
timer=new Timer();
timer.start();
armM = new Victor(7);
rollers =new Victor(6);
mainDrive=new RobotDrive(frontLeft,rearLeft,frontRight,rearRight);
mainDrive.setInvertedMotor(RobotDrive.MotorType.kFrontRight,true);
mainDrive.setInvertedMotor(RobotDrive.MotorType.kRearRight, true);
armP = new AnalogPotentiometer(1);
distance= new AnalogChannel(2);
ultra=new Ultrasonic(6,7);
ultra.setAutomaticMode(true);
compress=new Compressor(5,1);
handJoint=new Pneumatics(3,4);
//ultra = new Ultrasonic(6,5);
//ultra.setAutomaticMode(true);
winch = new Winch(secondStick);
}
示例10: initialize
import edu.wpi.first.wpilibj.RobotDrive; //導入方法依賴的package包/類
@Override
public void initialize()
{
rightFront = new Talon(0);
rightBack = new Talon(1);
leftFront = new Talon(3);
leftBack = new Talon(2);
drivetrain = new RobotDrive(leftBack, leftFront, rightBack, rightFront);
gyro = new Gyro(0);
drivetrain.setInvertedMotor(MotorType.kFrontRight, true);
drivetrain.setInvertedMotor(MotorType.kRearRight, true);
}
示例11: initialize
import edu.wpi.first.wpilibj.RobotDrive; //導入方法依賴的package包/類
public void initialize()
{
rearLeftMotor = new Jaguar(0);
frontLeftMotor = new Jaguar(1);
liftMotor = new Jaguar(2);
liftMotor2 = new Jaguar(3);
liftEncoder = new Encoder(6, 7, false, EncodingType.k4X);
drivetrain = new RobotDrive(rearLeftMotor, frontLeftMotor);
drivetrain.setInvertedMotor(MotorType.kFrontLeft, true);
drivetrain.setInvertedMotor(MotorType.kFrontRight, true);
halsensor = new DigitalInput(0);
horizontalCamera = new Servo(8);
verticalCamera = new Servo(9);
solenoid = new DoubleSolenoid(0,1);
gyro = new Gyro(1);
accelerometer = new BuiltInAccelerometer();
liftEncoder.reset();
RobotHardwareWoodbot hardware = (RobotHardwareWoodbot)Robot.bot;
LiveWindow.addActuator("Drive Train", "Front Left Motor", (Jaguar)hardware.frontLeftMotor);
LiveWindow.addActuator("Drive Train", "Back Left Motor", (Jaguar)hardware.rearLeftMotor);
//LiveWindow.addActuator("Drive Train", "Front Right Motor", (Jaguar)hardware.frontRightMotor);
//LiveWindow.addActuator("Drive Train", "Back Right Motor", (Jaguar)hardware.rearRightMotor);
}
示例12: initialize
import edu.wpi.first.wpilibj.RobotDrive; //導入方法依賴的package包/類
@Override
public void initialize()
{
//PWM
liftMotor = new Victor(0); //2);
leftMotors = new Victor(1);
rightMotors = new Victor(2); //0);
armMotors = new Victor(3);
transmission = new Servo(7);
//CAN
armSolenoid = new DoubleSolenoid(4,5);
//DIO
liftEncoder = new Encoder(0, 1, false, EncodingType.k4X);
liftBottomLimit = new DigitalInput(2);
liftTopLimit = new DigitalInput(3);
backupLiftBottomLimit = new DigitalInput(5);
switch1 = new DigitalInput(9);
switch2 = new DigitalInput(8);
//ANALOG
gyro = new Gyro(0);
//roboRio
accelerometer = new BuiltInAccelerometer();
//Stuff
drivetrain = new RobotDrive(leftMotors, rightMotors);
liftSpeedRatio = 1; //Half power default
liftGear = 1;
driverSpeedRatio = 1;
debounceComp = 0;
drivetrain.setInvertedMotor(MotorType.kRearLeft, true);
drivetrain.setInvertedMotor(MotorType.kRearRight, true);
}
示例13: initialize
import edu.wpi.first.wpilibj.RobotDrive; //導入方法依賴的package包/類
@Override
public void initialize()
{
//PWM
liftMotor = new Talon(0); //2);
leftMotors = new Talon(1);
rightMotors = new Talon(2); //0);
armMotors = new Talon(3);
transmission = new Servo(7);
//CAN
armSolenoid = new DoubleSolenoid(4,5);
//DIO
/*liftEncoder = new Encoder(0, 1, false, EncodingType.k4X);
liftBottomLimit = new DigitalInput(2);
liftTopLimit = new DigitalInput(3);
backupLiftBottomLimit = new DigitalInput(4);
switch1 = new DigitalInput(9);
switch2 = new DigitalInput(8);*/
//ANALOG
gyro = new Gyro(0);
//roboRio
accelerometer = new BuiltInAccelerometer();
//Stuff
drivetrain = new RobotDrive(leftMotors, rightMotors);
liftSpeedRatio = 1; //Half power default
liftGear = 1;
driverSpeedRatio = 1;
debounceComp = 0;
drivetrain.setInvertedMotor(MotorType.kRearLeft, true);
drivetrain.setInvertedMotor(MotorType.kRearRight, true);
}
示例14: DriveTrain
import edu.wpi.first.wpilibj.RobotDrive; //導入方法依賴的package包/類
public DriveTrain() {
// Set up the motors ...
this.leftMotor = new Jaguar(Robot.KickMotors.LEFT_PORT);
this.rightMotor = new Jaguar(Robot.KickMotors.RIGHT_PORT);
// And the drive controller ...
drive = new RobotDrive(leftMotor, rightMotor);
drive.setInvertedMotor(Robot.KickMotors.LEFT_POSITION, Robot.KickMotors.LEFT_REVERSED);
drive.setInvertedMotor(Robot.KickMotors.RIGHT_POSITION, Robot.KickMotors.RIGHT_REVERSED);
drive.setSafetyEnabled(false);
setMaxDriveSpeed(Robot.KickMotors.INITIAL_MAX_KICK_SPEED);
}
示例15: robotInit
import edu.wpi.first.wpilibj.RobotDrive; //導入方法依賴的package包/類
/**
* This function is run when the robot is first started up and should be used for any initialization code.
*/
public void robotInit() {
// We use separate Joytstick instances since it's actually just one Logitech controller, but we'll actually
// use separate but specific axes for the left and right side ...
controller = new LogitechController(Inputs.CONTROLLER_PORT, Mode.D, DriveStyle.TANK);
drive = new RobotDrive(LeftDriveMotor.OUTPUT_PORT, RightDriveMotor.OUTPUT_PORT);
drive.setInvertedMotor(RightDriveMotor.POSITION, RightDriveMotor.INVERTED);
drive.setInvertedMotor(LeftDriveMotor.POSITION, LeftDriveMotor.INVERTED);
}