SRX closed-loop problems


My team used the SRX closed loop last year, and we want to use it again this year with the versaplanetary encoders on our drivetrain. I tried doing the same as last year, but it does not seem to work at all.

Basically i have 4 versa planetary gearboxes and one of them has the built in encoder. I use the Follower mode for 3 of them, and the Position mode for the leading one. When I use the method Set(), with distance as a parameter to move, it just runs at full speed until I disable the robot. I tried printing the encoder value, and it goes way over the setpoint, like it doesn’t even care.
Anyone ever had this problem? thanks

The Unit scaling is different this year. If using CTRE Magnetic Encoder, the units are in rotations/RPM, not Talon native units. Please read section 17.2 in the Talon SRX Software Reference Manual.

I am using the CtreMagEncoder_Relative control mode, with a setpoint of 1 and it still goes full speed. I checked and my sensor is not reversed

I tried using the reverseSensor() method but it does not affect the velocity at all.

Problem solved. Note to myself. seems like enableControl() needs to be called

enableControl() shouldn’t be necessary unless disableControl() is called somewhere. OR if you are calling changeMode() but not calling set() immediately after like in Section 16.12 (Talon SRX Software Reference Manual).

Just in case it helps anyone else, a simple Java example for Position Closed-Loop.

I changed a lot of stuff while debugging, so it might be a combinaison of different things. Everything works fine now