Log in

View Full Version : SRX closed-loop problems


MaGiC_PiKaChU
30-01-2016, 20:01
Hi CD

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

ozrien
30-01-2016, 20:20
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.

MaGiC_PiKaChU
30-01-2016, 20:55
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

MaGiC_PiKaChU
30-01-2016, 21:54
I tried using the reverseSensor() method but it does not affect the velocity at all.

MaGiC_PiKaChU
30-01-2016, 23:13
Problem solved. Note to myself. seems like enableControl() needs to be called

ozrien
01-02-2016, 02:46
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.
https://github.com/CrossTheRoadElec/FRC-Examples/blob/master/JAVA_PositionClosedLoop/src/org/usfirst/frc/team469/robot/Robot.java

MaGiC_PiKaChU
01-02-2016, 12:02
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.
https://github.com/CrossTheRoadElec/FRC-Examples/blob/master/JAVA_PositionClosedLoop/src/org/usfirst/frc/team469/robot/Robot.java

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