Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Difference between "slotIdx" and "pidIdx" #33

Open
Wibis428 opened this issue Feb 11, 2018 · 1 comment
Open

Difference between "slotIdx" and "pidIdx" #33

Wibis428 opened this issue Feb 11, 2018 · 1 comment

Comments

@Wibis428
Copy link

There are a handful of functions that require either a "slot index" (slotIdx) or a "pid index" (pidIdx) parameter:

talon.configSelectedFeedbackSensor(FeedbackDevice feedbackDevice, int pidIdx, int timeoutMs);

talon.setSelectedSensorPosition(int sensorPos, int pidIdx, int timeoutMs);

talon.selectProfileSlot(int slotIdx, int pidIdx);

talon.config_kp(int slotIdx, double value, int timeoutMs);

talon.configAllowableClosedLoopError(int slotIdx, int allowableClosedLoopError, int timeoutMs)

From what I've read in the documentation, the talon is capable of storing 4 different "Motor Control Profiles" (pg. 72 of software reference manual). One motor control profile consists of one set of PID loop gains and a few other closed-loop preferences. Am I correct in assuming slotIdx refers to one of these motor control profiles? This makes sense to me, as talon.config_kp() and talon.configAllowableClosedLoopError() would need to know which motor control profile to apply the config to.

As for pidIdx, the only documentation I can find says that pidIdx should be "0 for primary closed loop, 1 for cascaded closed loop". I can't find anywhere where it's specified what this actually means, so I don't understand why talon.configSelectedFeedbackSensor(), talon.setSelectedSensorPosition(), and talon.selectProfileSlot() require this parameter. In every example usage I've seen of functions that require pidIdx, it's always passed in as 0 and never as 1. What's the point of this parameter, and how is it different than slotIdx?

Thanks in advance!

@laviRZ
Copy link
Contributor

laviRZ commented Aug 2, 2022

If you look at the documentation of BaseMotorController.selectProfileSlot() you'll see the following:

/**
* Selects which profile slot to use for closed-loop control.
*
* @param slotIdx
*            Profile slot to select.
* @param pidIdx
*            0 for Primary closed-loop. 1 for auxiliary closed-loop.
**/

So I would infer that the slotIdx refers to one of the four sets of PID values. From the documentation: "Closed Loop controller will pull closed-loop gain/setting information from a selected slot. There are four slots to choose from (for gain-scheduling)".

And pidIdx would refer to whether you want to use the regular closed loop PID (PID[0]) or the Auxiliary closed loop (PID[1]).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants