Add 2020 speed controllers (#2188)

Add CTRE TalonFX (PWMTalonFX)
Add Playing with Fusion Venom (PWMVenom)
This commit is contained in:
sciencewhiz
2019-12-22 11:51:43 -08:00
committed by Peter Johnson
parent 635882a9f7
commit 1ce24a7a2f
6 changed files with 233 additions and 0 deletions

View File

@@ -0,0 +1,49 @@
/*----------------------------------------------------------------------------*/
/* Copyright (c) 2019 FIRST. All Rights Reserved. */
/* Open Source Software - may be modified and shared by FRC teams. The code */
/* must be accompanied by the FIRST BSD license file in the root directory of */
/* the project. */
/*----------------------------------------------------------------------------*/
package edu.wpi.first.wpilibj;
import edu.wpi.first.hal.FRCNetComm.tResourceType;
import edu.wpi.first.hal.HAL;
import edu.wpi.first.wpilibj.smartdashboard.SendableRegistry;
/**
* Cross the Road Electronics (CTRE) Talon FX Speed Controller with PWM control.
*
* <p>Note that the TalonFX 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 TalonFX User Manual
* available from CTRE.
*
* <p><ul>
* <li>2.004ms = full "forward"
* <li>1.520ms = the "high end" of the deadband range
* <li>1.500ms = center of the deadband range (off)
* <li>1.480ms = the "low end" of the deadband range
* <li>0.997ms = full "reverse"
* </ul>
*/
public class PWMTalonFX extends PWMSpeedController {
/**
* Constructor for a TalonFX connected via PWM.
*
* @param channel The PWM channel that the Talon FX is attached to. 0-9 are on-board, 10-19 are
* on the MXP port
*/
public PWMTalonFX(final int channel) {
super(channel);
setBounds(2.004, 1.52, 1.50, 1.48, 0.997);
setPeriodMultiplier(PeriodMultiplier.k1X);
setSpeed(0.0);
setZeroLatch();
HAL.report(tResourceType.kResourceType_TalonFX, getChannel() + 1);
SendableRegistry.setName(this, "PWMTalonFX", getChannel());
}
}

View File

@@ -0,0 +1,48 @@
/*----------------------------------------------------------------------------*/
/* Copyright (c) 2019 FIRST. All Rights Reserved. */
/* Open Source Software - may be modified and shared by FRC teams. The code */
/* must be accompanied by the FIRST BSD license file in the root directory of */
/* the project. */
/*----------------------------------------------------------------------------*/
package edu.wpi.first.wpilibj;
import edu.wpi.first.hal.FRCNetComm.tResourceType;
import edu.wpi.first.hal.HAL;
import edu.wpi.first.wpilibj.smartdashboard.SendableRegistry;
/**
* Playing with Fusion Venom Smart Motor with PWM control.
*
* <p>Note that the Venom 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.
*
* <p><ul>
* <li>2.004ms = full "forward"
* <li>1.520ms = the "high end" of the deadband range
* <li>1.500ms = center of the deadband range (off)
* <li>1.480ms = the "low end" of the deadband range
* <li>0.997ms = full "reverse"
* </ul>
*/
public class PWMVenom extends PWMSpeedController {
/**
* Constructor for a Venom connected via PWM.
*
* @param channel The PWM channel that the Venom is attached to. 0-9 are on-board, 10-19 are
* on the MXP port
*/
public PWMVenom(final int channel) {
super(channel);
setBounds(2.004, 1.52, 1.50, 1.48, 0.997);
setPeriodMultiplier(PeriodMultiplier.k1X);
setSpeed(0.0);
setZeroLatch();
HAL.report(tResourceType.kResourceType_FusionVenom, getChannel() + 1);
SendableRegistry.setName(this, "PWMVenom", getChannel());
}
}