本文整理汇总了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);
}
示例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);
}
示例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
}
示例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);
}
示例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();
}
示例6: wheelIntake
import edu.wpi.first.wpilibj.Spark; //导入依赖的package包/类
public wheelIntake() {
leftIntakeMotor = new Spark(0);
rightIntakeMotor = new Spark(1);
}
示例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;
}
示例8: Climber
import edu.wpi.first.wpilibj.Spark; //导入依赖的package包/类
public Climber(int c1, int c2)
{
climber1 = new Spark(c1);
climber2 = new Spark(c2);
}
示例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;
}
示例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;
}
示例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);
}
示例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;
}
}
示例13: TurtleSpark
import edu.wpi.first.wpilibj.Spark; //导入依赖的package包/类
public TurtleSpark(int port, boolean isReversed) {
v = new Spark(port);
this.isReversed = isReversed;
}
示例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);
}
示例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;
}