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