Esempio 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)
Esempio n. 2
0
def config_talon(talon: WPI_TalonSRX, motor_config: MotorConfig) -> None:
    talon.enableVoltageCompensation(True)
    talon.configVoltageCompSaturation(motor_config.voltage_saturation)

    talon.enableCurrentLimit(True)
    talon.configPeakCurrentLimit(motor_config.peak_current)
    talon.configContinuousCurrentLimit(motor_config.continuous_current)

    talon.setNeutralMode(motor_config.default_mode)

    talon.configNeutralDeadband(motor_config.deadband)

    talon.configOpenLoopRamp(motor_config.ramp_rate)
Esempio n. 3
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)
Esempio n. 4
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)