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


Java CANJaguar.setSpeedReference方法代码示例

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


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

示例1: configSpeedControl

import edu.wpi.first.wpilibj.CANJaguar; //导入方法依赖的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: configSpeedControl

import edu.wpi.first.wpilibj.CANJaguar; //导入方法依赖的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(1, 0, 0);
        jag.changeControlMode(CANJaguar.ControlMode.kSpeed);
        jag.setSpeedReference(CANJaguar.SpeedReference.kQuadEncoder);
        jag.configEncoderCodesPerRev(CPR);
//        jag.setVoltageRampRate(VOLTAGE_RAMP);
        jag.enableControl();*/

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

示例3: robot2015preseason

import edu.wpi.first.wpilibj.CANJaguar; //导入方法依赖的package包/类
public robot2015preseason()
{
    try
    {
        Drive = new drive();
        
        driver_left_joystick = new Joystick(1);
        driver_right_joystick = new Joystick(2);
        
        front_left_jaguar = new CANJaguar(10);
        front_left_jaguar.changeControlMode(CANJaguar.ControlMode.kPercentVbus);
        front_left_jaguar.setSpeedReference(CANJaguar.SpeedReference.kQuadEncoder);
        front_left_jaguar.setPositionReference(CANJaguar.PositionReference.kQuadEncoder);
        front_left_jaguar.configEncoderCodesPerRev(250);
        
        back_left_jaguar = new CANJaguar(11);
        back_left_jaguar.changeControlMode(CANJaguar.ControlMode.kPercentVbus);
        back_left_jaguar.setSpeedReference(CANJaguar.SpeedReference.kQuadEncoder);
        back_left_jaguar.setPositionReference(CANJaguar.PositionReference.kQuadEncoder);
        back_left_jaguar.configEncoderCodesPerRev(250);
        
        back_right_jaguar = new CANJaguar(12);
        back_right_jaguar.changeControlMode(CANJaguar.ControlMode.kPercentVbus);
        back_right_jaguar.setSpeedReference(CANJaguar.SpeedReference.kQuadEncoder);
        back_right_jaguar.setPositionReference(CANJaguar.PositionReference.kQuadEncoder);
        back_right_jaguar.configEncoderCodesPerRev(250);
        
        front_right_jaguar = new CANJaguar(13);
        front_right_jaguar.changeControlMode(CANJaguar.ControlMode.kPercentVbus);
        front_right_jaguar.setSpeedReference(CANJaguar.SpeedReference.kQuadEncoder);
        front_right_jaguar.setPositionReference(CANJaguar.PositionReference.kQuadEncoder);
        front_right_jaguar.configEncoderCodesPerRev(250);

    }
    catch (CANTimeoutException ex)
    {
        ex.printStackTrace();
    }
}
 
开发者ID:1504,项目名称:robot2015preseason,代码行数:40,代码来源:robot2015preseason.java


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