Exploring PID Control Challenges for CIM Motor with Victor SPX on roboRIO

Hello everyone,

I attempted to implement PID control for a CIM motor controlled by the Victor SPX on the roboRIO. However, there is a challenge as the encoder is not a CANcoder and is connected to the roboRIO’s DIO port. I haven’t been able to locate a straightforward solution using CTRE’s built-in Closed Loop functionality.

Nonetheless, I’ve included some screenshots to provide a visual representation of our current setup. Thank you, everyone, for your assistance.

Best regards.


I’m rusty, but I think that you’ll have to run the PID on the RoboRio ~using the WPILIB~. If you want to do the closed loop on controller, you’ll need a Talon SRX and appropriate breakouts to plug the encoder directly in to the controller ~or a CANIfier/CANCoder~.

1 Like

Have you considered using a language other than LabView?

Per the most recent usage statistics, barely anyone is still using LabView anymore and it’s increasingly hard to find reliable programming help in that language.

Java isn’t hard to pick up, I swear!

7 Likes

CTRE’s closed loop functionality is only for Talon motor controllers, not Victors. Victors do not support this feature.

The LabVIEW port of WPILib isn’t feature complete and doesn’t include a PID controller. LabVIEW has its own included PID controller, though I personally am not fond of it for FRC use. The unofficial WPILib LabVIEW Math library could be used, or a simple PD controller could be written (they’re not particularly complicated).

3 Likes

Thanks!
I’ll try hard and see.

I couldn’t find any information indicating that WPILIB supports LabVIEW when I checked. Additionally, there don’t appear to be any available resources for CANIfier or CANCoder at the moment.

This isn’t supported by CTRE’s library in any language.

I’m having trouble understanding this compared to your recommendation of Python in the thread below, given that LabVIEW has >3x the teams using it as Python.

Python is extremely closely-related to other WPILib APIs; it is generally pretty easy to get support for Python from someone who knows Java, or vice-versa. The “small ecosystem” effects are way less crippling.

As others have said, if your encoders are connected to the roboRIO, the PID needs to be run on the roboRIO.

I’m a little confused by the encoder open options you chose. Generally I’d suggest:

image

Here is the executing code — Put in a consistent loop – in periodic tasks.

The library functions are here:

There are samples under the Help → Find Examples

1 Like

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.