微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

edu.wpi.first.wpilibj.VictorSP的实例源码

项目:R2017    文件Shooter.java   
public Shooter() {
    shooterMotor = new VictorSP(Constants.SHOOTER);
    shooterMotor2 = new VictorSP(Constants.SHOOTER_2);

    shooterMotor.setInverted(true);
    shooterMotor2.setInverted(true);

    hallEffect = new Counter(Constants.HALL_EFFECT);
    hallEffect.setdistancePerpulse(1);
}
项目:R2017    文件DriveTrain.java   
public DriveTrain () {
    rightMotors = new VictorSP(Constants.DRIVETRAIN_RIGHT);
    leftMotors = new VictorSP(Constants.DRIVETRAIN_LEFT);

    rightMotors.setInverted(rightInverted);
    leftMotors.setInverted(leftInverted);

    encLeft = new Encoder(Constants.ENCODER_LEFT_1,Constants.ENCODER_LEFT_2);
    encLeft.setdistancePerpulse(Constants.DRIVEWHEEL_CIRCUMFERENCE / Constants.DRIVE_pulseS_PER_REVOLUTION);

    encRight = new Encoder(Constants.ENCODER_RIGHT_1,Constants.ENCODER_RIGHT_2);
    encRight.setdistancePerpulse(Constants.DRIVEWHEEL_CIRCUMFERENCE / Constants.DRIVE_pulseS_PER_REVOLUTION);
}
项目:FRC-2016-Robot-Code    文件Robot.java   
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);
    }
项目:1797-2017    文件RobotMap.java   
public static void init() {

        // Drivetrain
        DRIVETRAIN_ROBOT_DRIVE = new RobotDrive(0,1);

        DRIVETRAIN_ENCODER_LEFT = new Encoder(0,1);
        DRIVETRAIN_ENCODER_LEFT.setdistancePerpulse(0.0481);

        DRIVETRAIN_ENCODER_RIGHT = new Encoder(2,3,true);
        DRIVETRAIN_ENCODER_RIGHT.setdistancePerpulse(0.0481);

        // Floor Gear
        FLOORGEAR_INTAKE = new VictorSP(2);
        FLOORGEAR_LIFTER = new DoubleSolenoid(0,1);
        FLOORGEAR_BLOCKER = new DoubleSolenoid(2,3);

        // climber
        climBER = new VictorSP(3);

        // Passive Gear
        SLOTGEAR_HOLDER = new DoubleSolenoid(4,5);

        // Vision
        VISION_SERVER = CameraServer.getInstance();

        VISION_CAMERA = VISION_SERVER.startAutomaticCapture("FRONT",0);

        VISION_CAMERA.getProperty("saturation").set(20);
        VISION_CAMERA.getProperty("gain").set(50);
        VISION_CAMERA.getProperty("exposure_auto").set(1);
        VISION_CAMERA.getProperty("brightness").set(50);
        VISION_CAMERA.getProperty("exposure_absolute").set(1);
        VISION_CAMERA.getProperty("exposure_auto_priority").set(0);

    }
项目:FRC-5800-Stronghold    文件CommandMotor.java   
public CommandMotor(Subsystem5800 requiredSubsystem,VictorSP motor,double speed) {
    super(requiredSubsystem);
    this.motor = motor;
    this.speed = speed;
}
项目:FRC-5800-Stronghold    文件CommandMotorTime.java   
public CommandMotorTime(Subsystem5800 requiredSubsystem,double speed,double timeout) {
    super(requiredSubsystem);
    this.setTimeout(speed);
    this.motor = motor;
    this.speed = speed;
}
项目:2017TestBench    文件RobotMap.java   
public static void init() {
    // BEGIN AUTOGENERATED CODE,SOURCE=ROBOTBUILDER ID=CONSTRUCTORS
    motorsVictor0 = new VictorSP(0);
    LiveWindow.addActuator("Motors","Victor0",(VictorSP) motorsVictor0);

    motorsVictor1 = new VictorSP(1);
    LiveWindow.addActuator("Motors","Victor1",(VictorSP) motorsVictor1);


    LiveWindow.addActuator("Motors","TalonSRX",(CANTalon) motorsCANTalon);

    electricalPowerdistributionPanel1 = new PowerdistributionPanel(0);
    LiveWindow.addSensor("Electrical","PowerdistributionPanel 1",electricalPowerdistributionPanel1);

    sensorsAnalogGyro1 = new AnalogGyro(0);
    LiveWindow.addSensor("Sensors","AnalogGyro 1",sensorsAnalogGyro1);
    sensorsAnalogGyro1.setSensitivity(0.007);


    // END AUTOGENERATED CODE,SOURCE=ROBOTBUILDER ID=CONSTRUCTORS
}
项目:R2017    文件climberAndIntake.java   
public climberAndIntake(Controls controls) {
    this.controls = controls;

    climberIntakeMotor = new VictorSP(Constants.climBER_INTAKE);
    climberIntakeMotor2 = new VictorSP(Constants.climBER_INTAKE_2);
}
项目:R2017    文件Indexer.java   
public Indexer() {
    indexerMotorBelt = new VictorSP(Constants.INDEXER_BELT);
    indexerMotorRoller = new VictorSP(Constants.INDEXER2_ROLLER);
}
项目:2017SteamBot2    文件DriveTrain.java   
public DriveTrain() {
    Robot.logList.add(this);
    ahrs = new AHRS(RobotMap.Ports.AHRS);
    left = new VictorSP(RobotMap.Ports.leftDriveMotor);
    right = new VictorSP(RobotMap.Ports.rightDriveMotor);
    right.setInverted(true);

    final double gearRatio = 4/3;
    final double ticksPerRev = 2048;
    final double radius = 1.5;
    final double magic = 1/.737;
    final double calculated = (radius * 2 * Math.PI) * gearRatio * magic / ticksPerRev;

    ahrs.reset();

    leftEncoder = new Encoder(RobotMap.Ports.leftEncoderOne,RobotMap.Ports.leftEncoderTwo,true,EncodingType.k4X);
    leftEncoder.setdistancePerpulse(calculated);
    leftEncoder.setPIDSourceType(PIDSourceType.kRate);
    rightEncoder = new Encoder(RobotMap.Ports.rightEncoderOne,RobotMap.Ports.rightEncoderTwo,false,EncodingType.k4X);
    rightEncoder.setdistancePerpulse(calculated);
    rightEncoder.setPIDSourceType(PIDSourceType.kRate);

    leftPID = new PIDController(
            RobotMap.Values.driveTrainP,RobotMap.Values.driveTrainI,RobotMap.Values.driveTrainD,RobotMap.Values.driveTrainF,new RateEncoder(leftEncoder),left);
    leftPID.setInputRange(-300,300);
    leftPID.setoutputRange(-1,1);
    rightPID = new PIDController(
            RobotMap.Values.driveTrainP,new RateEncoder(rightEncoder),right);
    rightPID.setInputRange(-300,300);
    rightPID.setoutputRange(-1,1);

    // Let's show everything on the LiveWindow
    LiveWindow.addActuator("Drive Train","Left Motor",(VictorSP) left);
    LiveWindow.addActuator("Drive Train","Right Motor",(VictorSP) right);
    LiveWindow.addSensor("Drive Train","Left Encoder",leftEncoder);
    LiveWindow.addSensor("Drive Train","Right Encoder",rightEncoder);
    LiveWindow.addSensor("Drive Train","Gyro",ahrs);
    LiveWindow.addActuator("Drive Train","PID",leftPID);

}
项目:2016-Robot-Final    文件Drive.java   
public Drive() {
// Instantiate VictorSPs
leftFront = new VictorSP(RobotMap.DriveMap.PWM_LEFT_FRONT);
leftBack = new VictorSP(RobotMap.DriveMap.PWM_LEFT_BACK);
rightFront = new VictorSP(RobotMap.DriveMap.PWM_RIGHT_FRONT);
rightBack = new VictorSP(RobotMap.DriveMap.PWM_RIGHT_BACK);

// Create list of motors
leftMotors = new ArrayList<SpeedController>();
leftMotors.add(leftFront);
leftMotors.add(leftBack);

rightMotors = new ArrayList<SpeedController>();
rightMotors.add(rightFront);
rightMotors.add(rightBack);

// Instantiate Encoders
leftEncoder = new Encoder(RobotMap.DriveMap.dio_ENCODER_LEFT_A,RobotMap.DriveMap.dio_ENCODER_LEFT_B);
rightEncoder = new Encoder(RobotMap.DriveMap.dio_ENCODER_RIGHT_A,RobotMap.DriveMap.dio_ENCODER_RIGHT_B);

// Invert VictorSPs
leftFront.setInverted(RobotMap.DriveMap.INV_LEFT_FRONT);
leftBack.setInverted(RobotMap.DriveMap.INV_LEFT_BACK);
rightFront.setInverted(RobotMap.DriveMap.INV_RIGHT_FRONT);
rightBack.setInverted(RobotMap.DriveMap.INV_RIGHT_BACK);

// Invert Encoders
// leftEncoder.setReverseDirection(RobotMap.DriveMap.INV_ENCODER_LEFT);
// rightEncoder.setReverseDirection(RobotMap.DriveMap.INV_ENCODER_RIGHT);

// Set distance per pulse
leftEncoder.setdistancePerpulse(RobotMap.DriveMap.disTANCE_PER_pulse);
rightEncoder.setdistancePerpulse(RobotMap.DriveMap.disTANCE_PER_pulse);

// Instantiate solenoid
solenoid = new DoubleSolenoid(RobotMap.DriveMap.soL_FORWARD,RobotMap.DriveMap.soL_REVERSE);

// Instantiate drivesides

leftSide = new DriveSide(leftMotors,leftEncoder);
rightSide = new DriveSide(rightMotors,rightEncoder);
   }
项目:2016-Robot    文件Drive.java   
public Drive() {
// Instantiate VictorSPs
leftFront = new VictorSP(RobotMap.DriveMap.PWM_LEFT_FRONT);
leftBack = new VictorSP(RobotMap.DriveMap.PWM_LEFT_BACK);
rightFront = new VictorSP(RobotMap.DriveMap.PWM_RIGHT_FRONT);
rightBack = new VictorSP(RobotMap.DriveMap.PWM_RIGHT_BACK);

// Create list of motors
leftMotors = new ArrayList<SpeedController>();
leftMotors.add(leftFront);
leftMotors.add(leftBack);

rightMotors = new ArrayList<SpeedController>();
rightMotors.add(rightFront);
rightMotors.add(rightBack);

// Instantiate Encoders
leftEncoder = new Encoder(RobotMap.DriveMap.dio_ENCODER_LEFT_A,rightEncoder);
   }
项目: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;
    }
}
项目:1797-2017    文件RobotMap.java   
public static void init() {

        // Drivetrain
        DRIVETRAIN_ROBOT_DRIVE = new RobotDrive(0,5);

        // Storage
        STORAGE_INTAKE = new VictorSP(4);
        STORAGE_AGITATOR = new VictorSP(5);

        // Shooter
        SHOOTER_CONVEYOR = new VictorSP(6);
        SHOOTER_WHEELS = new VictorSP(7);
        SHOOTER_ENCODER = new Encoder(4,5);
        SHOOTER_ENCODER.setPIDSourceType(PIDSourceType.kRate);
        SHOOTER_PID = new PIDController(1,SHOOTER_ENCODER,SHOOTER_WHEELS);

        // Vision
        VISION_SERVER = CameraServer.getInstance();

        VISION_CAMERA = VISION_SERVER.startAutomaticCapture("FRONT",0);
        VISION_CAMERA.setResolution(kVISION_WIDTH,kVISION_HEIGHT);
        kVISION_CENTER_X = kVISION_WIDTH / 2 - 0.5;
        kVISION_FOCAL_LENGTH = kVISION_WIDTH / (2 * Math.tan(Math.toradians(kVISION_FOV / 2)));

        VISION_CAMERA.getProperty("saturation").set(20);
        VISION_CAMERA.getProperty("gain").set(0);
        VISION_CAMERA.getProperty("exposure_auto").set(1);
        VISION_CAMERA.getProperty("brightness").set(50);
        VISION_CAMERA.getProperty("exposure_absolute").set(1);
        VISION_CAMERA.getProperty("exposure_auto_priority").set(0);

        VISION_PIPELINE = new gripPipeline();

        VISION_SINK = VISION_SERVER.getVideo();

        // Network
        NETWORKTABLE = NetworkTable.getTable("Network Table");

    }
项目:turtleshell    文件TurtlevictorSP.java   
public TurtlevictorSP(int port,boolean isReversed) {
    v = new VictorSP(port);
    this.isReversed = isReversed;
}
项目:turtleshell    文件TurtlevictorSP.java   
public TurtlevictorSP(int port) {
    victor = new VictorSP(port);
}
项目:strongback-java    文件Hardware.java   
/**
 * Create a motor driven by a VEX Robotics Victor SP speed controller 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 victorSP(int channel,DoubletoDoubleFunction speedLimiter) {
    return new HardwareMotor(new VictorSP(channel),speedLimiter);
}

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。