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


Java Jaguar類代碼示例

本文整理匯總了Java中edu.wpi.first.wpilibj.Jaguar的典型用法代碼示例。如果您正苦於以下問題:Java Jaguar類的具體用法?Java Jaguar怎麽用?Java Jaguar使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


Jaguar類屬於edu.wpi.first.wpilibj包,在下文中一共展示了Jaguar類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: hdrive

import edu.wpi.first.wpilibj.Jaguar; //導入依賴的package包/類
public static void hdrive(RobotDrive drive, int pwm_hmotor, Joystick js, boolean squared) {
//		hdrive_L = js.getY() * (js.getY()) + js.getZ();
//		hdrive_R = js.getY() - js.getZ();
//		hdrive_H = js.getX();
//		hdrive_hmotor = new Jaguar(pwm_hmotor);
//		drive.setLeftRightMotorOutputs((hdrive_L > 1) ? 1 : ((hdrive_L < -1) ? -1 : hdrive_L),
//				(hdrive_R > 1) ? 1 : ((hdrive_R < -1) ? -1 : hdrive_R));
//		hdrive_hmotor.set((hdrive_H > 1) ? 1 : ((hdrive_H < -1) ? -1 : hdrive_H));
		hdrive_X = js.getX();
		hdrive_X *= (squared ? hdrive_X : 1);
		hdrive_Y = js.getX();
		hdrive_Y *= (squared ? hdrive_Y : 1);
		hdrive_Z = js.getX();
		hdrive_Z *= (squared ? hdrive_Z : 1);
		hdrive_hmotor = new Jaguar(pwm_hmotor);
		drive.setLeftRightMotorOutputs(
				(hdrive_Y + hdrive_Z > 1) ? 1 : ((hdrive_Y + hdrive_Z < -1) ? -1 : hdrive_Y + hdrive_Z),
				(hdrive_Y - hdrive_Z > 1) ? 1 : ((hdrive_Y - hdrive_Z < -1) ? -1 : hdrive_Y - hdrive_Z));
		hdrive_hmotor.set((hdrive_X > 1) ? 1 : ((hdrive_X < -1) ? -1 : hdrive_X));
		
	}
 
開發者ID:homosapien97,項目名稱:UberbotsJava,代碼行數:22,代碼來源:UBMethods.java

示例2: RobotDrive6

import edu.wpi.first.wpilibj.Jaguar; //導入依賴的package包/類
/**
 * Constructor for RobotDrive with 4 motors specified with channel numbers.
 * Set up parameters for a four wheel drive system where all four motor pwm
 * channels are specified in the call. This call assumes Jaguars for
 * controlling the motors.
 *
 * @param frontLeftMotor Front left motor channel number on the default
 * digital module
 * @param rearLeftMotor Rear Left motor channel number on the default
 * digital module
 * @param frontRightMotor Front right motor channel number on the default
 * digital module
 * @param rearRightMotor Rear Right motor channel number on the default
 * digital module
 * @param middleLeftMotor third left motor PWM channel number
 * @param middleRightMotor third right motor PWM channel number
 */
public RobotDrive6(final int frontLeftMotor, final int rearLeftMotor,
        final int frontRightMotor, final int rearRightMotor,
        final int middleLeftMotor, final int middleRightMotor) {
    m_sensitivity = kDefaultSensitivity;
    m_maxOutput = kDefaultMaxOutput;
    m_rearLeftMotor = new Jaguar(rearLeftMotor);
    m_rearRightMotor = new Jaguar(rearRightMotor);
    m_frontLeftMotor = new Jaguar(frontLeftMotor);
    m_frontRightMotor = new Jaguar(frontRightMotor);
    m_middleLeftMotor = new Jaguar(middleLeftMotor);
    m_middleRightMotor = new Jaguar(middleRightMotor);
    for (int i = 0; i < kMaxNumberOfMotors; i++) {
        m_invertedMotors[i] = 1;
    }
    m_allocatedSpeedControllers = true;
    setupMotorSafety();
    drive(0, 0);
}
 
開發者ID:CarmelRobotics,項目名稱:aeronautical-facilitation,代碼行數:36,代碼來源:RobotDrive6.java

示例3: DrivePart

import edu.wpi.first.wpilibj.Jaguar; //導入依賴的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

示例4: RobotDriveSteering

import edu.wpi.first.wpilibj.Jaguar; //導入依賴的package包/類
/**
 * Constructor for RobotDrive with 4 motors specified with channel numbers.
 * Set up parameters for a four wheel drive system where all four motor pwm
 * channels are specified in the call. This call assumes Jaguars for
 * controlling the motors.
 *
 * @param frontLeftMotor Front left motor channel number on the default
 * digital module
 * @param rearLeftMotor Rear Left motor channel number on the default
 * digital module
 * @param frontRightMotor Front right motor channel number on the default
 * digital module
 * @param rearRightMotor Rear Right motor channel number on the default
 * digital module
 */
public RobotDriveSteering(final int frontLeftMotor, final int rearLeftMotor,
        final int frontRightMotor, final int rearRightMotor) {
    m_sensitivity = kDefaultSensitivity;
    m_maxOutput = kDefaultMaxOutput;
    m_rearLeftMotor = new Jaguar(rearLeftMotor);
    m_rearRightMotor = new Jaguar(rearRightMotor);
    m_frontLeftMotor = new Jaguar(frontLeftMotor);
    m_frontRightMotor = new Jaguar(frontRightMotor);
    for (int i = 0; i < kMaxNumberOfMotors; i++) {
        m_invertedMotors[i] = 1;
    }
    m_allocatedSpeedControllers = true;
    setupMotorSafety();
    drive(0, 0);
}
 
開發者ID:BreakerBots,項目名稱:Felix-2014,代碼行數:31,代碼來源:RobotDriveSteering.java

示例5: RobotOutput

import edu.wpi.first.wpilibj.Jaguar; //導入依賴的package包/類
/**
 * Instantiates a new robot output.
 */
private RobotOutput() {		
	
	this.forces = ChiliFunctions.fillArrayWithZeros(this.forces);
	
	front_left = new Talon(ChiliConstants.front_left_motor);
	rear_left = new Talon(ChiliConstants.rear_left_motor);
	front_right = new Talon(ChiliConstants.front_right_motor);
	rear_right = new Talon(ChiliConstants.rear_right_motor);
	left_lifter = new Jaguar(ChiliConstants.left_lifter_motor);
	right_lifter = new Jaguar(ChiliConstants.right_lifter_motor);
	
	//Sensor object for some cheating.
	//Objecto de sensor. "Trampa" para obtener ciertos valores.
	sensor = SensorInput.getInstance();
	
	/*front_left.setSafetyEnabled(true);
	rear_left.setSafetyEnabled(true);
	front_right.setSafetyEnabled(true);
	rear_right.setSafetyEnabled(true);
	left_lifter.setSafetyEnabled(true);
	right_lifter.setSafetyEnabled(true);*/
}
 
開發者ID:Chilean-Heart,項目名稱:2015-frc-robot,代碼行數:26,代碼來源:RobotOutput.java

示例6: BTMotor

import edu.wpi.first.wpilibj.Jaguar; //導入依賴的package包/類
public BTMotor(int port, boolean isCan)
{
    isCANBus = isCan;
    if (isCANBus)
    {
        //int maxTries = 0;
        //while(CANMotor == null && maxTries < 10)
        //{
            try{
                CANMotor = new CANJaguar(port);
            }
            catch(Exception CANTimeoutException){
                Log.log("Error initialising CANJaguar");
            }
        //}
        //if (maxTries >= 10)
            //Log.log("CANJaguar(" + port + ") failed to initialize.");
    }
    else
    {
        PWMMotor = new Jaguar(port);
    }
}
 
開發者ID:IpFruion,項目名稱:RobotBlueTwilight2013,代碼行數:24,代碼來源:BTMotor.java

示例7: instanciate

import edu.wpi.first.wpilibj.Jaguar; //導入依賴的package包/類
public void instanciate(int port, boolean isCan, boolean isVoltage)
{
    isCANBus = isCan;
    portNum = port;
    voltage = isVoltage;
    if (isCANBus) {
        try{
            CANMotor = new CANJaguar(port);
            if (isVoltage)
            {
                setVoltageControlMode();
            }
            successJag = true;
        }
        catch(Exception CANTimeoutException){
            System.out.println("Error initialising CANJaguar at port: " +port);
        }
    }
    else
    {
        PWMMotor = new Jaguar(port);
    }
}
 
開發者ID:IpFruion,項目名稱:RobotBlueTwilight2013,代碼行數:24,代碼來源:BTMotor.java

示例8: robotInit

import edu.wpi.first.wpilibj.Jaguar; //導入依賴的package包/類
/**
 * This function is run when the robot is first started up and should be
 * used for any initialization code.
 */
public void robotInit()
{
    // PWM's
    mTestMotor1 = new Talon(0);
    mTestMotor2 = new Jaguar(1);
    mServo = new Servo(2);

    // Digital IO
    mDigitalOutput = new DigitalOutput(0);
    mRightEncoder = new Encoder(4, 5);
    mLeftEncoder = new Encoder(1, 2);
    mUltrasonic = new Ultrasonic(7, 6);

    // Analog IO
    mAnalogGryo = new AnalogGyro(0);
    mPotentiometer = new AnalogPotentiometer(1);

    // Solenoid
    mSolenoid = new Solenoid(0);

    // Relay
    mRelay = new Relay(0);

    // Joysticks
    mJoystick1 = new Joystick(0);
    mJoystick2 = new XboxController(1);

    // SPI
    mSpiGryo = new ADXRS450_Gyro();

    // Utilities
    mTimer = new Timer();
    mPDP = new PowerDistributionPanel();

    Preferences.getInstance().putDouble("Motor One Speed", .5);
}
 
開發者ID:ArcticWarriors,項目名稱:snobot-2017,代碼行數:41,代碼來源:Snobot.java

示例9: getController

import edu.wpi.first.wpilibj.Jaguar; //導入依賴的package包/類
public SpeedController getController(){
	if (allocated) return null;
	this.allocated = true;
	switch (this.speedControllerType){
		case kJaguar:
			return new Jaguar(this.PWMChannel);
		case kTalon:
			return new Talon(this.PWMChannel);
		default:
			return null;
	}
}
 
開發者ID:Millerbots,項目名稱:FRC2549-2016,代碼行數:13,代碼來源:MotorDescriptor.java

示例10: Manipulator

import edu.wpi.first.wpilibj.Jaguar; //導入依賴的package包/類
Manipulator() {
	LiftMotor = new Jaguar(ELEVATOR_MOTOR_PORT) {
		public void set(double speed) {
			super.set(-speed);
		}
	};
	encoder = new Encoder(ENCODER_CHANNEL_A, ENCODER_CHANNEL_B);
}
 
開發者ID:FRC1076,項目名稱:FRC1076-2015-Competition_Robot,代碼行數:9,代碼來源:Manipulator.java

示例11: Robot

import edu.wpi.first.wpilibj.Jaguar; //導入依賴的package包/類
public Robot() {
    stick = new Joystick(0);
    try {
        /* Construct Digital I/O Objects */
        pwm_out_9 = new Victor(        getChannelFromPin( PinType.PWM,       9 ));
        pwm_out_8 = new Jaguar(        getChannelFromPin( PinType.PWM,       8 ));
        dig_in_7  = new DigitalInput(  getChannelFromPin( PinType.DigitalIO, 7 ));
        dig_in_6  = new DigitalInput(  getChannelFromPin( PinType.DigitalIO, 6 ));
        dig_out_5 = new DigitalOutput( getChannelFromPin( PinType.DigitalIO, 5 ));
        dig_out_4 = new DigitalOutput( getChannelFromPin( PinType.DigitalIO, 4 ));
        enc_3and2 = new Encoder(       getChannelFromPin( PinType.DigitalIO, 3 ),
                                       getChannelFromPin( PinType.DigitalIO, 2 ));
        enc_1and0 = new Encoder(       getChannelFromPin( PinType.DigitalIO, 1 ),
                                       getChannelFromPin( PinType.DigitalIO, 0 ));
        
        /* Construct Analog I/O Objects */
        /* NOTE:  Due to a board layout issue on the navX MXP board revision */
        /* 3.3, there is noticeable crosstalk between AN IN pins 3, 2 and 1. */
        /* For that reason, use of pin 3 and pin 2 is NOT RECOMMENDED.       */
        an_in_1   = new AnalogInput(   getChannelFromPin( PinType.AnalogIn,  1 ));
        an_trig_0 = new AnalogTrigger( getChannelFromPin( PinType.AnalogIn,  0 ));
        an_trig_0_counter = new Counter( an_trig_0 );
        
        an_out_1  = new AnalogOutput(  getChannelFromPin( PinType.AnalogOut, 1 ));
        an_out_0  = new AnalogOutput(  getChannelFromPin( PinType.AnalogOut, 0 ));
        
        /* Configure I/O Objects */
        pwm_out_9.setSafetyEnabled(false); /* Disable Motor Safety for Demo */
        pwm_out_8.setSafetyEnabled(false); /* Disable Motor Safety for Demo */
        
        /* Configure Analog Trigger */
        an_trig_0.setAveraged(true);
        an_trig_0.setLimitsVoltage(MIN_AN_TRIGGER_VOLTAGE, MAX_AN_TRIGGER_VOLTAGE);
    } catch (RuntimeException ex ) {
        DriverStation.reportError( "Error instantiating MXP pin on navX MXP:  " 
                                    + ex.getMessage(), true);
    }
}
 
開發者ID:FRC1458,項目名稱:turtleshell,代碼行數:39,代碼來源:Robot.java

示例12: Robot

import edu.wpi.first.wpilibj.Jaguar; //導入依賴的package包/類
public Robot() {
    myRobot = new RobotDrive(RobotMap.FRONT_LEFT_MOTOR, RobotMap.REAR_LEFT_MOTOR,
RobotMap.FRONT_RIGHT_MOTOR, RobotMap.REAR_RIGHT_MOTOR);
    myRobot.setExpiration(0.1);
    stick = new Joystick(RobotMap.JOYSTICK_PORT1);
    compressor = new Compressor();
    solenoid = new DoubleSolenoid(RobotMap.SOLENOID_PCM_PORT1,
    		RobotMap.SOLENOID_PCM_PORT2);
    jaguar = new Jaguar(RobotMap.LIFT_MOTOR);
}
 
開發者ID:TechnoWolves5518,項目名稱:2015RobotCode,代碼行數:11,代碼來源:Robot.java

示例13: init

import edu.wpi.first.wpilibj.Jaguar; //導入依賴的package包/類
public void init(Environment env) {
	inputMethod = env.getInput();
	
	speedController = new MultiMotor(new SpeedController[]{new Jaguar(RobotMap.SHOOTER_MOTOR_1),new Jaguar(RobotMap.SHOOTER_MOTOR_2)});
    speedController.set(0);
    solenoid = new Solenoid(RobotMap.SHOOTER_SOLENOID);
}
 
開發者ID:Impact2585,項目名稱:aerbot-champs,代碼行數:8,代碼來源:ShooterSystem.java

示例14: init

import edu.wpi.first.wpilibj.Jaguar; //導入依賴的package包/類
public void init(Environment environment) {
    shooter = environment.getShooterSystem();
    motorController = new Jaguar(RobotMap.INTAKE_MOTOR_CONTROLLER);
    intakeLift = new Relay(RobotMap.INTAKE_LIFT_1);
    intakeLift2 = new Relay(RobotMap.INTAKE_LIFT_2);
    close();
    inputMethod = environment.getInput();
}
 
開發者ID:Impact2585,項目名稱:aerbot-champs,代碼行數:9,代碼來源:IntakeSystem.java

示例15: Drive

import edu.wpi.first.wpilibj.Jaguar; //導入依賴的package包/類
public Drive() {
    super();
    jFL = new Jaguar(RobotMap.MECANUM_FRONT_LEFT);
    jBL = new Jaguar(RobotMap.MECANUM_BACK_LEFT);
    jFR = new Jaguar(RobotMap.MECANUM_FRONT_RIGHT);
    jBR = new Jaguar(RobotMap.MECANUM_BACK_RIGHT);
    drive = new RobotDrive(jFL, jBL, jFR, jBR);
}
 
開發者ID:owatonnarobotics,項目名稱:2014RobotCode,代碼行數:9,代碼來源:Drive.java


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