本文整理汇总了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());
}
示例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());
}
示例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();
}
}