本文整理匯總了Java中edu.wpi.first.wpilibj.SpeedController.get方法的典型用法代碼示例。如果您正苦於以下問題:Java SpeedController.get方法的具體用法?Java SpeedController.get怎麽用?Java SpeedController.get使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類edu.wpi.first.wpilibj.SpeedController
的用法示例。
在下文中一共展示了SpeedController.get方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: get
import edu.wpi.first.wpilibj.SpeedController; //導入方法依賴的package包/類
/**
* The current speed of this Drivetrain
* @return the current PWM value of the SpeedController collection (-1.0 to 1.0)
*/
public double get() {
// All of the SpeedControllers will always be set to the same value,
// so simply get the value of the first one.
final SpeedController controller = (SpeedController) motorControllers.firstElement();
return inversion * controller.get();
}
示例2: getAll
import edu.wpi.first.wpilibj.SpeedController; //導入方法依賴的package包/類
/**
* The speeds of all SpeedControllers within this Drivetrain.
* They should all be nearly identical, other than error due to floating point
* precision.
* @return an array enumerating all the current PWM values of the SpeedController collection (-1.0 to 1.0)
*/
public double[] getAll() {
final double[] result = new double[motorControllers.size()];
for (int i = 0; i < motorControllers.size(); ++i) {
final SpeedController controller = (SpeedController) motorControllers.elementAt(i);
result[i] = controller.get();
}
return result;
}
示例3: PIDVelocityController
import edu.wpi.first.wpilibj.SpeedController; //導入方法依賴的package包/類
/**
* Initializes the PID controller, the output motor, and the input
* encoder without a feedforward coefficient (Kf).
*
* @param motor
* motor to use as PID output
* @param encoder
* encoder to use as the PID rate input
* @param Kp
* Proportional coefficient
* @param Ki
* Integral coefficient
* @param Kd
* Derivative coefficient
* @author Noah Golmant
* @written 11 Feb 2014
*/
PIDVelocityController (final SpeedController motor,
final Encoder encoder,
double Kp, double Ki, double Kd)
{
// Initialize the PIDController using the base PIDSubsystem constructor
super(Kp, Ki, Kd);
// Set the PID input, output, and initial speed.
this.motor = motor;
this.encoder = encoder;
this.setSpeed = motor.get();
}