當前位置: 首頁>>代碼示例>>Java>>正文


Java RobotDrive.setInvertedMotor方法代碼示例

本文整理匯總了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;
	}
}
 
開發者ID:MTHSRoboticsClub,項目名稱:FRC-2017,代碼行數:22,代碼來源:CANDriveAssembly.java

示例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);
}
 
開發者ID:Foximus-Prime,項目名稱:2014-Assist-Robot-Prime,代碼行數:22,代碼來源:DrivePart.java

示例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);
}
 
開發者ID:Nashoba-Robotics,項目名稱:NR-2014-CMD,代碼行數:25,代碼來源:Drive.java

示例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);
	}
 
開發者ID:GraV-Robotics,項目名稱:FRC-2016-Robot-Code,代碼行數:28,代碼來源:Robot.java

示例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);
}
 
開發者ID:wjaneal,項目名稱:liastem,代碼行數:11,代碼來源:Robot.java

示例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
  }
 
開發者ID:FRCTeam1073-TheForceTeam,項目名稱:robot15,代碼行數:9,代碼來源:DriveTrain.java

示例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);

}
 
開發者ID:FRC-Team-3140,項目名稱:FRC2015Code,代碼行數:37,代碼來源:RobotMap.java

示例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);
	
}
 
開發者ID:TechnoWolves5518,項目名稱:2015RobotCode,代碼行數:13,代碼來源:DriveTrain.java

示例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);
    
}
 
開發者ID:4500robotics,項目名稱:4500-2014,代碼行數:36,代碼來源:RobotTemplate.java

示例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);
}
 
開發者ID:SCOTS-Bots,項目名稱:FRC-2015-Robot-Java,代碼行數:15,代碼來源:RobotHardwareMecbot.java

示例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);
}
 
開發者ID:SCOTS-Bots,項目名稱:FRC-2015-Robot-Java,代碼行數:33,代碼來源:RobotHardwareWoodbot.java

示例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);
}
 
開發者ID:SCOTS-Bots,項目名稱:FRC-2015-Robot-Java,代碼行數:41,代碼來源:RobotHardwareCompbot.java

示例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);
}
 
開發者ID:SCOTS-Bots,項目名稱:FRC-2015-Robot-Java,代碼行數:40,代碼來源:RobotHardwarePracticebot.java

示例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);
}
 
開發者ID:frc-4931,項目名稱:2014-Robot,代碼行數:13,代碼來源:DriveTrain.java

示例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);
}
 
開發者ID:frc-4931,項目名稱:2014-Robot,代碼行數:12,代碼來源:TankDriveRobot.java


注:本文中的edu.wpi.first.wpilibj.RobotDrive.setInvertedMotor方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。