当前位置: 首页>>代码示例>>Java>>正文


Java Spark类代码示例

本文整理汇总了Java中edu.wpi.first.wpilibj.Spark的典型用法代码示例。如果您正苦于以下问题:Java Spark类的具体用法?Java Spark怎么用?Java Spark使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


Spark类属于edu.wpi.first.wpilibj包,在下文中一共展示了Spark类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: Manipulation

import edu.wpi.first.wpilibj.Spark; //导入依赖的package包/类
public Manipulation(int in1,int in2,int out)
{
	input1 = new Spark(in1);
	input2 = new Spark(in2);
	output = new CANTalon(out);
	output.changeControlMode(TalonControlMode.PercentVbus);
}
 
开发者ID:RAR1741,项目名称:RA17_RobotCode,代码行数:8,代码来源:Manipulation.java

示例2: GearPlacer

import edu.wpi.first.wpilibj.Spark; //导入依赖的package包/类
public GearPlacer(int m)
{
	state = GearPlacerState.Waiting;
	M = new Spark(m);
	motorSpeedOpen = Config.getSetting("gearMotorSpeedOpen", .4);
	motorSpeedClose = Config.getSetting("gearMotorSpeedClose", 0.25);
}
 
开发者ID:RAR1741,项目名称:RA17_RobotCode,代码行数:8,代码来源:GearPlacer.java

示例3: init

import edu.wpi.first.wpilibj.Spark; //导入依赖的package包/类
public static void init() {
    // BEGIN AUTOGENERATED CODE, SOURCE=ROBOTBUILDER ID=CONSTRUCTORS
    leftSideLeftPaddle = new Spark(0);
    LiveWindow.addActuator("LeftSide", "LeftPaddle", (Spark) leftSideLeftPaddle);
    
    leftSideLeftOut = new DigitalInput(0);
    LiveWindow.addSensor("LeftSide", "LeftOut", leftSideLeftOut);
    
    leftSideLeftIn = new DigitalInput(2);
    LiveWindow.addSensor("LeftSide", "LeftIn", leftSideLeftIn);
    
    rightSideRightPaddle = new Spark(1);
    LiveWindow.addActuator("RightSide", "RightPaddle", (Spark) rightSideRightPaddle);
    
    rightSideRightOut = new DigitalInput(1);
    LiveWindow.addSensor("RightSide", "RightOut", rightSideRightOut);
    
    rightSideRightIn = new DigitalInput(3);
    LiveWindow.addSensor("RightSide", "RightIn", rightSideRightIn);
    
    gearGate = new Spark(2);
    LiveWindow.addActuator("Gear", "Gate", (Spark) gearGate);
    
    gearGearIsIn = new DigitalInput(4);
    LiveWindow.addSensor("Gear", "GearIsIn", gearGearIsIn);
    

// END AUTOGENERATED CODE, SOURCE=ROBOTBUILDER ID=CONSTRUCTORS
}
 
开发者ID:ElectricGeorge,项目名称:GearBot,代码行数:30,代码来源:RobotMap.java

示例4: Shooter

import edu.wpi.first.wpilibj.Spark; //导入依赖的package包/类
public Shooter() {
isCocked = false;

motor = new Spark(RobotMap.ShooterMap.PWM_MOTOR);
motor.setInverted(RobotMap.ShooterMap.INV_MOTOR);

solenoid = new DoubleSolenoid(RobotMap.ShooterMap.SOL_FORWARD, RobotMap.ShooterMap.SOL_REVERSE);
   }
 
开发者ID:Team236,项目名称:2016-Robot-Final,代码行数:9,代码来源:Shooter.java

示例5: Intake

import edu.wpi.first.wpilibj.Spark; //导入依赖的package包/类
public Intake() {
motor = new Spark(RobotMap.IntakeMap.PWM_MOTOR);
motor.setInverted(RobotMap.IntakeMap.INV_MOTOR);

limit = new DigitalInput(RobotMap.IntakeMap.DIO_LIMIT);
stop();
   }
 
开发者ID:Team236,项目名称:2016-Robot-Final,代码行数:8,代码来源:Intake.java

示例6: wheelIntake

import edu.wpi.first.wpilibj.Spark; //导入依赖的package包/类
public wheelIntake() {
	leftIntakeMotor = new Spark(0);
	rightIntakeMotor = new Spark(1);
}
 
开发者ID:2141-Spartonics,项目名称:Spartonics-Code,代码行数:5,代码来源:wheelIntake.java

示例7: Shooter

import edu.wpi.first.wpilibj.Spark; //导入依赖的package包/类
/**
 * Creates a new shooter object for the 2017 season, SteamWorks
 * 
 * @param controller
 *            The motor controller which runs the flywheel.
 * @param ballLoaderSensor
 *            Detects if there's a ball ready to be fired.
 * @param elevator
 *            The motor controller which loads the loader elevator
 * @param acceptableFlywheelSpeedError
 *            The error we can handle on the flywheel without losing
 *            accuracy
 * @param visionTargeting
 *            Our vision processor object, used to target the high boiler.
 * @param acceptableGimbalError
 *            The acceptable angular angle, in degrees, the gimbal turret is
 *            allowed to be off.
 * @param gimbalMotor
 *            The motor controller the turret is run on
 * @param agitatorMotor
 *            The motor controller the agitator motor is connected to
 * @param distanceSensor
 *            TODO
 * @param gimbalEnc
 *            The potentiometer that reads the bearing of the turret.
 */
public Shooter (CANTalon controller, IRSensor ballLoaderSensor,
        Spark elevator, double acceptableFlywheelSpeedError,
        ImageProcessor visionTargeting, double acceptableGimbalError,
        CANTalon gimbalMotor, Victor agitatorMotor,
        UltraSonic distanceSensor)
{
    this.flywheelController = controller;
    this.elevatorSensor = ballLoaderSensor;
    this.elevatorController = elevator;
    this.acceptableError = acceptableFlywheelSpeedError;
    this.visionTargeter = visionTargeting;
    this.gimbalMotor = gimbalMotor;
    this.agitatorMotor = agitatorMotor;
    this.distanceSensor = distanceSensor;
}
 
开发者ID:FIRST-Team-339,项目名称:2017,代码行数:42,代码来源:Shooter.java

示例8: Climber

import edu.wpi.first.wpilibj.Spark; //导入依赖的package包/类
public Climber(int c1, int c2)
{
	climber1 = new Spark(c1);
	climber2 = new Spark(c2);
}
 
开发者ID:RAR1741,项目名称:RA17_RobotCode,代码行数:6,代码来源:Climber.java

示例9: initialize

import edu.wpi.first.wpilibj.Spark; //导入依赖的package包/类
public static void initialize() {
	if (initialized)
		return;

	// reset trigger init time
	initTriggerTime = Utility.getFPGATime();		

       // create and reset collector relay
	collectorSolenoid = new Spark(HardwareIDs.COLLECTOR_SOLENOID_PWM_ID);
               
       // create and reset gear tray spark & relay
       gearTrayRelay = new Relay(HardwareIDs.GEAR_TRAY_RELAY_CHANNEL_1,Relay.Direction.kForward);
       gearTrayRelay.set(Relay.Value.kOff);
       gearTrayRelay2 = new Relay(HardwareIDs.GEAR_TRAY_RELAY_CHANNEL_2,Relay.Direction.kForward);
       gearTrayRelay2.set(Relay.Value.kOff);

	// create motors & servos
	transportMotor = new Spark(HardwareIDs.TRANSPORT_PWM_ID);
	collectorMotor = new CANTalon(HardwareIDs.COLLECTOR_TALON_ID);
	agitatorServo = new Spark(HardwareIDs.AGITATOR_PWM_ID);    // continuous servo control modeled as Spark PWM
	
	feederMotor = new CANTalon(HardwareIDs.FEEDER_TALON_ID);
	shooterMotor = new CANTalon(HardwareIDs.SHOOTER_TALON_ID);
	
	// set up shooter motor sensor
	shooterMotor.reverseSensor(false);
	shooterMotor.setFeedbackDevice(FeedbackDevice.QuadEncoder);

	// FOR REFERENCE ONLY:
	//shooterMotor.configEncoderCodesPerRev(12);   // use this ONLY if you are NOT reading Native units
	
	// USE FOR DEBUG ONLY:  configure shooter motor for open loop speed control
	//shooterMotor.changeControlMode(TalonControlMode.PercentVbus);
	
	// configure shooter motor for closed loop speed control
	shooterMotor.changeControlMode(TalonControlMode.Speed);
	shooterMotor.configNominalOutputVoltage(+0.0f, -0.0f);
	shooterMotor.configPeakOutputVoltage(+12.0f, -12.0f);
	
	// set PID(F) for shooter motor (one profile only)
	shooterMotor.setProfile(0);
	
	shooterMotor.setP(3.45);
	shooterMotor.setI(0);
	shooterMotor.setD(0.5);
	shooterMotor.setF(9.175);
	
	// make sure all motors are off
	resetMotors();
	
	gamepad = new Joystick(HardwareIDs.GAMEPAD_ID);
	
	initialized = true;
}
 
开发者ID:MTHSRoboticsClub,项目名称:FRC-2017,代码行数:55,代码来源:BallManagement.java

示例10: initialize

import edu.wpi.first.wpilibj.Spark; //导入依赖的package包/类
public static void initialize() {
	if (initialized)
		return;

	// reset trigger init time
	initTriggerTime = Utility.getFPGATime();		

       // create and reset collector relay
	collectorSolenoid = new Spark(HardwareIDs.COLLECTOR_SOLENOID_PWM_ID);
               
       // create and reset gear tray spark & relay
       gearTrayRelay = new Relay(HardwareIDs.GEAR_TRAY_RELAY_CHANNEL_1,Relay.Direction.kForward);
       gearTrayRelay.set(Relay.Value.kOff);
       gearTrayRelay2 = new Relay(HardwareIDs.GEAR_TRAY_RELAY_CHANNEL_2,Relay.Direction.kForward);
       gearTrayRelay2.set(Relay.Value.kOff);

	// create motors & servos
	transportMotor = new Spark(HardwareIDs.TRANSPORT_PWM_ID);
	collectorMotor = new CANTalon(HardwareIDs.COLLECTOR_TALON_ID);
	agitatorServo = new Spark(HardwareIDs.AGITATOR_PWM_ID);    // continuous servo control modeled as Spark PWM
	
	feederMotor = new CANTalon(HardwareIDs.FEEDER_TALON_ID);
	shooterMotor = new CANTalon(HardwareIDs.SHOOTER_TALON_ID);
	
	// set up shooter motor sensor
	shooterMotor.reverseSensor(false);
	shooterMotor.setFeedbackDevice(FeedbackDevice.QuadEncoder);

	// FOR REFERENCE ONLY:
	//shooterMotor.configEncoderCodesPerRev(12);   // use this ONLY if you are NOT reading Native units
	
	// USE FOR DEBUG ONLY:  configure shooter motor for open loop speed control
	//shooterMotor.changeControlMode(TalonControlMode.PercentVbus);
	
	// configure shooter motor for closed loop speed control
	shooterMotor.changeControlMode(TalonControlMode.Speed);
	shooterMotor.configNominalOutputVoltage(+0.0f, -0.0f);
	shooterMotor.configPeakOutputVoltage(+12.0f, -12.0f);
	
	// set PID(F) for shooter motor (one profile only)
	shooterMotor.setProfile(0);
	
	shooterMotor.setP(P_COEFF);
	shooterMotor.setI(I_COEFF);
	shooterMotor.setD(D_COEFF);
	shooterMotor.setF(F_COEFF);
	
	// make sure all motors are off
	resetMotors();
	
	gamepad = new Joystick(HardwareIDs.GAMEPAD_ID);
	
	initialized = true;
}
 
开发者ID:MTHSRoboticsClub,项目名称:FRC-2017,代码行数:55,代码来源:BallManagement.java

示例11: Shooter

import edu.wpi.first.wpilibj.Spark; //导入依赖的package包/类
/**
    * Constructor
    */
private Shooter() {
	left = new Spark(SHOOTER_LEFT);
	right = new Spark(SHOOTER_RIGHT);
	launcher = new DoubleSolenoid(1, LAUNCHER_EXT, LAUNCHER_RET);
}
 
开发者ID:FRC-Team-3140,项目名称:FRC-2016,代码行数:9,代码来源:Shooter.java

示例12: SpeedControllerSubsystem

import edu.wpi.first.wpilibj.Spark; //导入依赖的package包/类
public SpeedControllerSubsystem(SpeedControllerSubsystemType type, final int channel) {
	switch(type) {
	case CAN_JAGUAR:
		this._controller = new CANJaguar(channel);
		break;
		
	case CAN_TALON:
		this._controller = new CANTalon(channel);
		break;
		
	case JAGUAR:
		this._controller = new Jaguar(channel);
		break;
		
	case SD540:
		this._controller = new SD540(channel);
		break;
		
	case SPARK:
		this._controller = new Spark(channel);
		break;
		
	case TALON:
		this._controller = new Talon(channel);
		break;
		
	case TALON_SRX:
		this._controller = new TalonSRX(channel);
		break;
		
	case VICTOR:
		this._controller = new Victor(channel);
		break;
		
	case VICTOR_SP:
		this._controller = new VictorSP(channel);
		break;

	default:
		break;
	}
}
 
开发者ID:frc2503,项目名称:r2016,代码行数:43,代码来源:SpeedControllerSubsystem.java

示例13: TurtleSpark

import edu.wpi.first.wpilibj.Spark; //导入依赖的package包/类
public TurtleSpark(int port, boolean isReversed) {
	v = new Spark(port);
	this.isReversed = isReversed;
}
 
开发者ID:FRC1458,项目名称:turtleshell,代码行数:5,代码来源:TurtleSpark.java

示例14: Chassis

import edu.wpi.first.wpilibj.Spark; //导入依赖的package包/类
public Chassis() {
	rightMotor = new Spark(4);
	leftMotor = new Spark(RobotMap.LEFT_MOTOR);
	drive = new RobotDrive(rightMotor, leftMotor);
	
	this.drive.setInvertedMotor(MotorType.kFrontLeft, true);
	this.drive.setInvertedMotor(MotorType.kFrontRight, true);
	
	
}
 
开发者ID:2141-Spartonics,项目名称:Spartonics-Code,代码行数:11,代码来源:Chassis.java

示例15: initialize

import edu.wpi.first.wpilibj.Spark; //导入依赖的package包/类
public static void initialize() {
	
	if (initialized)
		return;
	
	motorL = new Spark(LEFT_SPARK_ID);
	motorR = new Spark(RIGHT_SPARK_ID);
	
	driveControl = new DriveControl();
	
	Controller.initialize();
	
	initialized = true;
}
 
开发者ID:MTHSRoboticsClub,项目名称:FRC-2017,代码行数:15,代码来源:FreezyDriveTrain.java


注:本文中的edu.wpi.first.wpilibj.Spark类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。