Exemplo n.º 1
0
def configure_drivetrain(motor: ctre.WPI_TalonSRX):
    """
    Configure a given motor controller for drivetrain usage
        :param motor:ctre.WPI_TalonSRX: The motor to be configured
    """
    # TODO make sure to uncomment next line on first test/deploy
    # motor.configFactoryDefault()
    motor.configOpenLoopRamp(0.2)
    motor.clearStickyFaults()
    motor.enableCurrentLimit(True)
    motor.configContinuousCurrentLimit(10)
    motor.configPeakCurrentLimit(0)
    motor.setNeutralMode(ctre.NeutralMode.Brake)
Exemplo n.º 2
0
 def configure_drivetrain_cim(motor: ctre.WPI_TalonSRX):
     """
     Configure a given motor controller for drivetrain usage
         :param motor:ctre.WPI_TalonSRX: The motor to be configured
     """
     # TODO Decide if following line is needed
     # motor.configFactoryDefault()
     # 0 is disabled for ramp rates, input is in seconds
     motor.configOpenLoopRamp(0.5)
     motor.clearStickyFaults()
     motor.enableCurrentLimit(True)
     motor.configContinuousCurrentLimit(70)
     motor.configPeakCurrentLimit(0)
     motor.setNeutralMode(ctre.NeutralMode.Brake)
Exemplo n.º 3
0
def configure_motor(motor: ctre.WPI_TalonSRX,
                    neutral_mode: ctre.NeutralMode,
                    peak_current=0,
                    peak_current_duration=0,
                    ramp_rate=0):
    # motor.configFactoryDefault()
    motor.clearStickyFaults()
    motor.setNeutralMode(neutral_mode)
    if peak_current != 0:
        motor.enableCurrentLimit(True)
        motor.configPeakCurrentLimit(peak_current)
        motor.configPeakCurrentDuration(peak_current_duration)
    else:
        motor.enableCurrentLimit(False)
    if ramp_rate != 0:
        motor.configOpenLoopRamp(ramp_rate)