Note that the DMC 60 uses the following bounds for PWM values. These values should work - * reasonably well for most controllers, but if users experience issues such as asymmetric behavior - * around the deadband or inability to saturate the controller in either direction, calibration is - * recommended. The calibration procedure can be found in the DMC 60 User Manual available from - * Digilent. - * - *
Note that the Jaguar uses the following bounds for PWM values. These values should work - * reasonably well for most controllers, but if users experience issues such as asymmetric behavior - * around the deadband or inability to saturate the controller in either direction, calibration is - * recommended. The calibration procedure can be found in the Jaguar User Manual available from - * Luminary Micro / Vex Robotics. - * - *
Note that the SD540 uses the following bounds for PWM values. These values should work - * reasonably well for most controllers, but if users experience issues such as asymmetric behavior - * around the deadband or inability to saturate the controller in either direction, calibration is - * recommended. The calibration procedure can be found in the SD540 User Manual available from - * Mindsensors. - * - *
Note that the Victor 888 uses the following bounds for PWM values. These values should work - * reasonably well for most controllers, but if users experience issues such as asymmetric behavior - * around the deadband or inability to saturate the controller in either direction, calibration is - * recommended. The calibration procedure can be found in the Victor 888 User Manual available from - * Vex Robotics. - * - *
The PWM value is set using a range of -1.0 to 1.0, appropriately scaling the value for the - * FPGA. - * - * @param speed The speed value between -1.0 and 1.0 to set. - */ - @Override - public void set(double speed) { - if (!m_disabled) { - m_speed = speed; - m_dio.updateDutyCycle(0.5 + 0.5 * (m_isInverted ? -speed : speed)); - m_pwm.setAlwaysHighMode(); - } - - feed(); - } - - /** - * Get the recently set value of the PWM. - * - * @return The most recently set value for the PWM between -1.0 and 1.0. - */ - @Override - public double get() { - return m_speed; - } - - @Override - public void setInverted(boolean isInverted) { - m_isInverted = isInverted; - } - - @Override - public boolean getInverted() { - return m_isInverted; - } - - /** - * Stop the motor. This is called by the MotorSafety object when it has a timeout for this PWM and - * needs to stop it from running. Calling set() will re-enable the motor. - */ - @Override - public void stopMotor() { - m_dio.updateDutyCycle(0.5); - m_pwm.setDisabled(); - } - - @Override - public String getDescription() { - return "Nidec " + getChannel(); - } - - /** Disable the motor. The enable() function must be called to re-enable the motor. */ - @Override - public void disable() { - m_disabled = true; - m_dio.updateDutyCycle(0.5); - m_pwm.setDisabled(); - } - - /** - * Re-enable the motor after disable() has been called. The set() function must be called to set a - * new motor speed. - */ - public void enable() { - m_disabled = false; - } - - /** - * Gets the channel number associated with the object. - * - * @return The channel number. - */ - public int getChannel() { - return m_pwm.getChannel(); - } - - @Override - public void initSendable(SendableBuilder builder) { - builder.setSmartDashboardType("Nidec Brushless"); - builder.setActuator(true); - builder.setSafeState(this::stopMotor); - builder.addDoubleProperty("Value", this::get, this::set); - } -} diff --git a/wpilibj/src/main/java/edu/wpi/first/wpilibj/shuffleboard/BuiltInWidgets.java b/wpilibj/src/main/java/edu/wpi/first/wpilibj/shuffleboard/BuiltInWidgets.java index c034a4a433..33017321c6 100644 --- a/wpilibj/src/main/java/edu/wpi/first/wpilibj/shuffleboard/BuiltInWidgets.java +++ b/wpilibj/src/main/java/edu/wpi/first/wpilibj/shuffleboard/BuiltInWidgets.java @@ -250,17 +250,13 @@ public enum BuiltInWidgets implements WidgetType { * *