Skip to content

Talon srx functionality

deltaA380 edited this page Apr 4, 2018 · 2 revisions

this year ctre used it's phoniex library outside of wpilib to impliement talon srx's. few functions were made to help smooth the impleimentation

**Basics of can bus ** basic overview

Documentation from phoenix library phoenix lib documentation

Key Functions Used

  1. convert velocity from units/100ms to unuits/s `

    /**

    • @param _talon

    • @return velocity in in/ second. from native taon units

    */

    public double getVelocity(TalonSRX _talon) {

     double velocity_milliseconds = (double) _talon.getSelectedSensorVelocity(0) / Consts.ticksPerRotation;
    
     double velocity_seconds = velocity_milliseconds *10* 6*Math.PI*.0254; 
    
     return velocity_seconds;
    

    }`

  2. talon srx settings setter for various software settings

`

/**

 * @param _talon

 * set up  for tann initatioation

 */

private void configureTalon(TalonSRX _talon) {

	_talon.configNominalOutputForward(0, Consts.timeOutMs);

	_talon.configNominalOutputReverse(0, Consts.timeOutMs);

	_talon.configPeakOutputForward(1, Consts.timeOutMs);

	_talon.configPeakOutputReverse(-1, Consts.timeOutMs);

	_talon.configAllowableClosedloopError(0, 0, Consts.timeOutMs);

	_talon.configNeutralDeadband(0.05, Consts.timeOutMs); 

	_talon.setNeutralMode(com.ctre.phoenix.motorcontrol.NeutralMode.Brake);

	_talon.setInverted(false);

	// Peak current and duration must be exceeded before corrent limit is activated.

	// When activated, current will be limited to continuous current.

    // Set peak current params to 0 if desired behavior is to immediately current-limit.

	_talon.enableCurrentLimit(true);

	_talon.configContinuousCurrentLimit(30,Consts.timeOutMs); // Must be 5 amps or more

	_talon.configPeakCurrentLimit(30, Consts.timeOutMs); // 100 A

	_talon.configPeakCurrentDuration(200,Consts.timeOutMs); // 200 ms

	

}`

to do for later go into detail about functions settings.

  1. different srx control modes
  • percent output scalled value from -1 to 1 representing some abritary level of "power" *velocity *porstion
Clone this wiki locally