Table of Contents

Class DifferentialFollower

Namespace
CTRE.Phoenix6.Controls
Assembly
Phoenix6.Hardware.dll

Follow the differential motor output of another Talon.

If Talon is in torque control, the differential torque is copied - which will increase the total torque applied. If Talon is in duty cycle output control, the differential duty cycle is matched. If Talon is in voltage output control, the differential motor voltage is matched. Motor direction either matches leader's configured direction or opposes it based on the MotorAlignment.

The leader must enable its DifferentialOutput status signal. The update rate of the status signal determines the update rate of the follower's output and should be no slower than 20 Hz.
public sealed class DifferentialFollower : ControlRequest, ICloneable
Inheritance
DifferentialFollower
Implements
Inherited Members

Constructors

DifferentialFollower(int, MotorAlignmentValue)

Follow the differential motor output of another Talon.

If Talon is in torque control, the differential torque is copied - which will increase the total torque applied. If Talon is in duty cycle output control, the differential duty cycle is matched. If Talon is in voltage output control, the differential motor voltage is matched. Motor direction either matches leader's configured direction or opposes it based on the MotorAlignment.

The leader must enable its DifferentialOutput status signal. The update rate of the status signal determines the update rate of the follower's output and should be no slower than 20 Hz. Device ID of the differential leader to follow. Set to Aligned for motor invert to match the leader's configured Invert - which is typical when leader and follower are mechanically linked and spin in the same direction. Set to Opposed for motor invert to oppose the leader's configured Invert - this is typical where the leader and follower mechanically spin in opposite directions.
public DifferentialFollower(int LeaderID, MotorAlignmentValue MotorAlignment)

Parameters

LeaderID int
MotorAlignment MotorAlignmentValue

Fields

LeaderID

Device ID of the differential leader to follow.

public int LeaderID

Field Value

int

MotorAlignment

Set to Aligned for motor invert to match the leader's configured Invert - which is typical when leader and follower are mechanically linked and spin in the same direction. Set to Opposed for motor invert to oppose the leader's configured Invert - this is typical where the leader and follower mechanically spin in opposite directions.

public MotorAlignmentValue MotorAlignment

Field Value

MotorAlignmentValue

UpdateFreqHz

The frequency at which this control will update. This is designated in Hertz, with a minimum of 20 Hz (every 50 ms) and a maximum of 1000 Hz (every 1 ms). Some update frequencies are not supported and will be promoted up to the next highest supported frequency.

If this field is set to 0 Hz, the control request will be sent immediately as a one-shot frame. This may be useful for advanced applications that require outputs to be synchronized with data acquisition. In this case, we recommend not exceeding 50 ms between control calls.
public double UpdateFreqHz

Field Value

double

Properties

Name

Name of this control request.

public string Name { get; }

Property Value

string

Methods

Clone()

Creates a copy of this control request.

public DifferentialFollower Clone()

Returns

DifferentialFollower

GetControlInfo()

Gets information about this control request.

public Dictionary<string, string> GetControlInfo()

Returns

Dictionary<string, string>

Dictionary of control parameter names and corresponding applied values

SendRequest(string, uint)

Sends this request out over CAN bus to the device for the device to apply.

public StatusCode SendRequest(string network, uint deviceHash)

Parameters

network string

Network to send request over

deviceHash uint

Device to send request to

Returns

StatusCode

Status of the send operation

ToString()

Provides the string representation of this object.

public override string ToString()

Returns

string

WithLeaderID(int)

Modifies this Control Request's LeaderID parameter and returns itself for method-chaining and easier to use request API.

Device ID of the differential leader to follow.
public DifferentialFollower WithLeaderID(int newLeaderID)

Parameters

newLeaderID int

Parameter to modify

Returns

DifferentialFollower

Itself

WithMotorAlignment(MotorAlignmentValue)

Modifies this Control Request's MotorAlignment parameter and returns itself for method-chaining and easier to use request API.

Set to Aligned for motor invert to match the leader's configured Invert - which is typical when leader and follower are mechanically linked and spin in the same direction. Set to Opposed for motor invert to oppose the leader's configured Invert - this is typical where the leader and follower mechanically spin in opposite directions.
public DifferentialFollower WithMotorAlignment(MotorAlignmentValue newMotorAlignment)

Parameters

newMotorAlignment MotorAlignmentValue

Parameter to modify

Returns

DifferentialFollower

Itself

WithUpdateFreqHz(double)

Sets the frequency at which this control will update. This is designated in Hertz, with a minimum of 20 Hz (every 50 ms) and a maximum of 1000 Hz (every 1 ms). Some update frequencies are not supported and will be promoted up to the next highest supported frequency.

If this field is set to 0 Hz, the control request will be sent immediately as a one-shot frame. This may be useful for advanced applications that require outputs to be synchronized with data acquisition. In this case, we recommend not exceeding 50 ms between control calls.
public DifferentialFollower WithUpdateFreqHz(double newUpdateFreqHz)

Parameters

newUpdateFreqHz double

Parameter to modify

Returns

DifferentialFollower

Itself