Java 类edu.wpi.first.wpilibj.Spark 实例源码

项目:RA17_RobotCode    文件:Manipulation.java   
public Manipulation(int in1,int in2,int out)
{
    input1 = new Spark(in1);
    input2 = new Spark(in2);
    output = new CANTalon(out);
    output.changeControlMode(TalonControlMode.PercentVbus);
}
项目:RA17_RobotCode    文件:GearPlacer.java   
public GearPlacer(int m)
{
    state = GearPlacerState.Waiting;
    M = new Spark(m);
    motorSpeedOpen = Config.getSetting("gearMotorSpeedOpen", .4);
    motorSpeedClose = Config.getSetting("gearMotorSpeedClose", 0.25);
}
项目:GearBot    文件:RobotMap.java   
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
}
项目:2016-Robot-Final    文件:Shooter.java   
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);
   }
项目:2016-Robot-Final    文件:Intake.java   
public Intake() {
motor = new Spark(RobotMap.IntakeMap.PWM_MOTOR);
motor.setInverted(RobotMap.IntakeMap.INV_MOTOR);

limit = new DigitalInput(RobotMap.IntakeMap.DIO_LIMIT);
stop();
   }
项目:2016-Robot    文件:Shooter.java   
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);
   }
项目:2016-Robot    文件:Intake.java   
public Intake() {
motor = new Spark(RobotMap.IntakeMap.PWM_MOTOR);
motor.setInverted(RobotMap.IntakeMap.INV_MOTOR);

limit = new DigitalInput(RobotMap.IntakeMap.DIO_LIMIT);
stop();
   }
项目:Spartonics-Code    文件:wheelIntake.java   
public wheelIntake() {
    leftIntakeMotor = new Spark(0);
    rightIntakeMotor = new Spark(1);
}
项目:2017    文件:Shooter.java   
/**
 * 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;
}
项目:RA17_RobotCode    文件:Climber.java   
public Climber(int c1, int c2)
{
    climber1 = new Spark(c1);
    climber2 = new Spark(c2);
}
项目:FRC-2017    文件:BallManagement.java   
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;
}
项目:FRC-2017    文件:BallManagement.java   
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;
}
项目:FRC-2016    文件:Shooter.java   
/**
    * Constructor
    */
private Shooter() {
    left = new Spark(SHOOTER_LEFT);
    right = new Spark(SHOOTER_RIGHT);
    launcher = new DoubleSolenoid(1, LAUNCHER_EXT, LAUNCHER_RET);
}
项目:r2016    文件:SpeedControllerSubsystem.java   
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;
    }
}
项目:turtleshell    文件:TurtleSpark.java   
public TurtleSpark(int port, boolean isReversed) {
    v = new Spark(port);
    this.isReversed = isReversed;
}
项目:Spartonics-Code    文件:Chassis.java   
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);


}
项目:FRC-2017    文件:FreezyDriveTrain.java   
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;
}
项目:strongback-java    文件:Hardware.java   
/**
 * Create a motor driven by a <a href="http://www.revrobotics.com/SPARK">RevRobotics Spark Motor Controller</a> on the
 * specified channel, with a custom speed limiting function.
 *
 * @param channel the channel the controller is connected to
 * @param speedLimiter function that will be used to limit the speed (input voltage); may not be null
 * @return a motor on the specified channel
 */
public static Motor spark(int channel, DoubleToDoubleFunction speedLimiter) {
    return new HardwareSpark(new Spark(channel), SPEED_LIMITER);
}