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


Java CANTimeoutException类代码示例

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


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

示例1: configSpeedControl

import edu.wpi.first.wpilibj.can.CANTimeoutException; //导入依赖的package包/类
private void configSpeedControl(CANJaguar jag) throws CANTimeoutException {
        final int CPR = 360;
        final double ENCODER_FINAL_POS = 0;
        final double VOLTAGE_RAMP = 40;
//        jag.changeControlMode(CANJaguar.ControlMode.kPercentVbus);
//        jag.setSpeedReference(CANJaguar.SpeedReference.kNone);
//        jag.enableControl();
//        jag.configMaxOutputVoltage(10);//ToDo: 
        // PIDs may be required.  Values here:
        //  http://www.chiefdelphi.com/forums/showthread.php?t=91384
        // and here:
        // http://www.chiefdelphi.com/forums/showthread.php?t=89721
        // neither seem correct.
//        jag.setPID(0.4, .005, 0);
        jag.setPID(0.3, 0.005, 0);
        jag.setSpeedReference(CANJaguar.SpeedReference.kQuadEncoder);
        jag.configEncoderCodesPerRev(CPR);
//        jag.setVoltageRampRate(VOLTAGE_RAMP);
        jag.enableControl();

//        System.out.println("Control Mode = " + jag.getControlMode());
    }
 
开发者ID:Team-4153,项目名称:IterativeEncoderTest,代码行数:23,代码来源:RobotMain.java

示例2: RoboDrive

import edu.wpi.first.wpilibj.can.CANTimeoutException; //导入依赖的package包/类
public RoboDrive(){
    
    try {
        //creates the motors
        aLeft = new CANJaguar(RobotMap.LEFT_DRIVE_MOTOR_ALPHA);
        bLeft = new CANJaguar(RobotMap.LEFT_DRIVE_MOTOR_BETA);//, CANJaguar.ControlMode.kSpeed);
        aRight = new CANJaguar(RobotMap.RIGHT_DRIVE_MOTOR_ALPHA);
        bRight = new CANJaguar(RobotMap.RIGHT_DRIVE_MOTOR_BETA);//, CANJaguar.ControlMode.kSpeed);

        //creates the drive train
        roboDrive = new RobotDrive(aLeft, bLeft, aRight, bRight);
        roboDrive.setSafetyEnabled(false);  
        
    } catch(CANTimeoutException ex) {
        ex.printStackTrace();
    }
}
 
开发者ID:iraiders,项目名称:2014Robot-,代码行数:18,代码来源:RoboDrive.java

示例3: BTCanJaguar

import edu.wpi.first.wpilibj.can.CANTimeoutException; //导入依赖的package包/类
private BTCanJaguar(int port, boolean isVoltage, BTDebugger debug)
{
    this.isVoltage = isVoltage;
    this.debug = debug;
    this.port = port;
    setVoltageMode(isVoltage);
    try {
        motor = new CANJaguar(port);
    } catch (CANTimeoutException ex) {
        debug.write(Constants.DebugLocation.BTMotor, Constants.Severity.SEVERE, "ERROR: Motor not initiated at port: "+port);
    }
    catch (Exception e)
    {
        debug.write(Constants.DebugLocation.BTMotor, Constants.Severity.SEVERE, "ERROR: Motor not initiated at port: "+port+" Exception: "+e.toString());
    }
}
 
开发者ID:saumikn,项目名称:Testbot14-15,代码行数:17,代码来源:BTCanJaguar.java

示例4: operatorControl

import edu.wpi.first.wpilibj.can.CANTimeoutException; //导入依赖的package包/类
/**
 * This function is called once each time the robot enters operator control.
 */
public void operatorControl() 
{
    while(isOperatorControl() && isEnabled())
    {
        //Tank stuff
        Drive.drive_tank(driver_left_joystick.getY(), driver_right_joystick.getY());
        System.out.println(Drive.get_front_left());
        try
        {
            front_left_jaguar.setX(Drive.get_front_left());
            back_left_jaguar.setX(Drive.get_back_left());
            back_right_jaguar.setX(Drive.get_back_right());
            front_right_jaguar.setX(Drive.get_front_right());
        }
        catch (CANTimeoutException ex)
        {
            ex.printStackTrace();
        }
        //todo: MECANUM
    }
}
 
开发者ID:1504,项目名称:robot2015preseason,代码行数:25,代码来源:robot2015preseason.java

示例5: rotate

import edu.wpi.first.wpilibj.can.CANTimeoutException; //导入依赖的package包/类
public void rotate(double distance, double i) {
    try {
        double zeroPosn = HardwareDefines.SHOOTER_POT_REV_LIM;
        double distToClick = distanceToPotClicks(distance);
        double currPosn = tiltJag.getPosition();
        double distErr = distToClick - currPosn;
        double p = (distErr / distToClick);
        
        if(distToClick > currPosn) {
            winchJag.configSoftPositionLimits(distToClick, zeroPosn);
        }
        else if(distToClick < currPosn) {
            winchJag.configSoftPositionLimits(zeroPosn, distToClick);
        }
        
        tiltJag.setPID(p, i, 0.0);
        tiltJag.enableControl();
        if(distToClick == currPosn) {
            rotated = true;
        }
    } catch(CANTimeoutException e) {
        System.out.println("Could not tilt the shooter!");
    }
}
 
开发者ID:alexbrinister,项目名称:Nashoba-Robotics2014,代码行数:25,代码来源:Shooter.java

示例6: reload

import edu.wpi.first.wpilibj.can.CANTimeoutException; //导入依赖的package包/类
public void reload(double distance) {
    try {
        double zeroPosn = HardwareDefines.SHOOTER_LIN_ENC_REV_LIM;
        double distToClick = distanceToLinEncClicks(distance);
        double currPosn = winchJag.getPosition();
        double distErr = distToClick - currPosn;
        double p = (distErr / distToClick);
        winchJag.configSoftPositionLimits(distToClick, zeroPosn);
        winchJag.setPID(p, 0, 0);
        winchJag.enableControl();
        if(distToClick == currPosn) {
            loaded = true;
        }
    }
    catch(CANTimeoutException e) {
        System.out.println("Could not reload shooter!");
    }
}
 
开发者ID:alexbrinister,项目名称:Nashoba-Robotics2014,代码行数:19,代码来源:Shooter.java

示例7: init

import edu.wpi.first.wpilibj.can.CANTimeoutException; //导入依赖的package包/类
public void init() {
    if(!hasInit) {
        left = new Victor(HardwareDefines.RIGHT_LOADER_VICTOR);
        try {
            right = new CANJaguar(HardwareDefines.LEFT_LOADER_JAG);
        }
        catch(CANTimeoutException e) {
            System.out.println("Could not instantiate left loader jag!");
        }
        hasInit = true;
    }
    else {
        System.out.println("The loader subsystem has already "
                                        + "been initialized!");
        return;
    }
}
 
开发者ID:alexbrinister,项目名称:Nashoba-Robotics2014,代码行数:18,代码来源:Loader.java

示例8: Puncher

import edu.wpi.first.wpilibj.can.CANTimeoutException; //导入依赖的package包/类
private Puncher() 
{
    try 
    {
        winch = new CANJaguar(RobotMap.WINCH_JAG);
        winch.configPotentiometerTurns(1);
        winch.setPositionReference(CANJaguar.PositionReference.kPotentiometer);
        winch.setSafetyEnabled(false);
        setWinchLimit(.95f);
    } 
    catch (CANTimeoutException ex) 
    {
        reportCANException(ex);
    }
    dogEar = new DoubleSolenoid(RobotMap.DOG_EAR_SOLENOID_DEPLOY, RobotMap.DOG_EAR_SOLENOID_UNDEPLOY);
    dogEar.set(Value.kReverse);
}
 
开发者ID:Nashoba-Robotics,项目名称:NR-2014-CMD,代码行数:18,代码来源:Puncher.java

示例9: setSpeed

import edu.wpi.first.wpilibj.can.CANTimeoutException; //导入依赖的package包/类
public void setSpeed(double left, double right){
    try{
        leftJag.setX(-left);
        rightJag.setX(right);
    }catch(CANTimeoutException e){
        try{
            canInit();
        }catch(CANTimeoutException f){
            System.out.println("canInit Failed");
        }
    }catch(NullPointerException g){
        try{
            canInit();
        }catch(CANTimeoutException h){
            System.out.println("canInit Failed");
        }
    }
}
 
开发者ID:Team4189,项目名称:CanBusRobot,代码行数:19,代码来源:CanChassis.java

示例10: RotateRight

import edu.wpi.first.wpilibj.can.CANTimeoutException; //导入依赖的package包/类
/***
  * RotateRight()
  * 
  * Turns the wheels to 90 degrees and then turn the wheels at what the speed is set at
  *
  * @param speed -1.0 ... 0.0 ... 1.0
  */
public void RotateRight(double speed)  throws CANTimeoutException
{
    if (!Steer(ROTATE_SETPOINT_RIGHT_90))
    {
        double error = middle.getPosition() 
                - ConvertJoystickToPosition(ROTATE_SETPOINT_RIGHT_90);
        //System.out.println(error);
        if (error < ReboundRumble.JOYSTICK_DEADBAND
                && error > (-1.0 * ReboundRumble.JOYSTICK_DEADBAND) )
        {
            left.set(speed);
            right.set(speed);
        }
    }
}
 
开发者ID:FIRST-FRC-Team-2028,项目名称:2012,代码行数:23,代码来源:SteeringUnit.java

示例11: ReboundRumble

import edu.wpi.first.wpilibj.can.CANTimeoutException; //导入依赖的package包/类
public ReboundRumble()
{
    super();
    if (DEBUG)
    {
        System.out.println("Entering Rebound Rumble constructor.");
    }
    try
    {
        drive = new CrabDrive();
    } catch (CANTimeoutException e)
    {
        System.out.println(e);
    }
    driverI = DriverStation.getInstance();
    game = new GameMech();
    if (DEBUG)
    {
        System.out.println("Exiting Rebound Rumble constructor.");
    }

}
 
开发者ID:FIRST-FRC-Team-2028,项目名称:2012,代码行数:23,代码来源:ReboundRumble.java

示例12: initEncoder

import edu.wpi.first.wpilibj.can.CANTimeoutException; //导入依赖的package包/类
private void initEncoder(){
    try {
        jaguar.configEncoderCodesPerRev(ticsPerRev); // Config encoder tics per rev
        
        // Set speed or position reference
        switch(controlMode.value){
            case ControlMode.kPosition_val:
                jaguar.setPositionReference(CANJaguar.PositionReference.kQuadEncoder);
                break;
            case ControlMode.kSpeed_val:
                jaguar.setSpeedReference(CANJaguar.SpeedReference.kQuadEncoder);
                break;
            default:
                break;
        }
    } catch (CANTimeoutException ex) {
        ex.printStackTrace();
    }
}
 
开发者ID:FRC79,项目名称:CK_16_Java,代码行数:20,代码来源:CANJagQuadEncoder.java

示例13: SlingShot

import edu.wpi.first.wpilibj.can.CANTimeoutException; //导入依赖的package包/类
public SlingShot()
    {
        try
        {
            shooterPull = new CANJaguar(ReboundRumble.SHOOTER_PULL_CAN_ID);
            shooterPull.changeControlMode(CANJaguar.ControlMode.kPercentVbus);
            shooterPull.configNeutralMode(CANJaguar.NeutralMode.kBrake);
            elevation = new CANJaguar(ReboundRumble.ELEVATION_CAN_ID);
            SetElevationPositionControl();
        } catch (CANTimeoutException ex)
        {
        }
        trigger = new Relay(ReboundRumble.SHOOTER_TRIGGER_RELAY_CHANNEL);
//        loadPosition = new DigitalInput(ReboundRumble.LOAD_POSITON_LIMIT_SWITCH);
//        slingMagnet = new Relay(ReboundRumble.SLING_ELECTROMAGNET_RELAY_CHANNEL);
        //  ballSensor = new DigitalInput(ReboundRumble.SHOOTER_BALL_SENSOR_GPIO_CHANNEL);
        settingForce = false;
    }
 
开发者ID:FIRST-FRC-Team-2028,项目名称:2012,代码行数:19,代码来源:SlingShot.java

示例14: SetElevation

import edu.wpi.first.wpilibj.can.CANTimeoutException; //导入依赖的package包/类
/**
 * SetElevation()
 *
 * This method will set the shooter to the angle specified by Aim()
 *
 * @param setPoint - angle reading in the range 0.1 ... 1.0
 *
 * @return boolean - true = the elevation is at the setpoint false = the
 * elevation is not yet at the setpoint
 */
public boolean SetElevation(double setPoint) throws CANTimeoutException
{
    elevationSetpoint = setPoint;
    if (!isElevationPIDControlled)
    {
        SetElevationPositionControl();
    }
    elevation.setX(setPoint);
    double angle = elevation.getPosition();
    if ((elevationSetpoint - angle) <= 0.05 && (elevationSetpoint - angle) >= -0.05)
    {
        return true;
    }
    return false;
}
 
开发者ID:FIRST-FRC-Team-2028,项目名称:2012,代码行数:26,代码来源:SlingShot.java

示例15: disabled

import edu.wpi.first.wpilibj.can.CANTimeoutException; //导入依赖的package包/类
public void disabled()
{
    
    try 
    {
        leftMotor.setX(0);
        rightMotor.setX(0);
        shooter.stop();   //  JAG CHANGE
        /*while(isDisabled())
        {
            System.out.println("Partial Sensor: " + climb.part.get() + " Top Sensor: " + climb.max.get());
           
        }*/
    }
    catch (CANTimeoutException ex) 
    {
        ex.printStackTrace();
    }
}
 
开发者ID:DevilTech,项目名称:UltimateAscentCode,代码行数:20,代码来源:RobotTemplate.java


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