dirtbikerxz / BaseTalonFXSwerve

Other
145 stars 176 forks source link

Module 3 occasionally starts at the wrong angle #20

Closed ritchiedc closed 1 year ago

ritchiedc commented 1 year ago

We had a problem where module 3 would sometimes get initialized to the wrong angle. This started happening more frequently at our first competition. Our drive system was based on the latest BaseFalconSwerve with the 1 second delay added before "resetModulesToAbsolute" in the Swerve constructor. Grasping at straws and thinking it to be an initialization issue we added another 1 second delay prior to the creation of the swerve module objects to allow all devices time to come up. We have not had the problem since. Could the delay have been less? Probably, but why rock the boat during competition. I wanted to record this in case someone else was having a similar issue.

Configuration: Original Roborio, Pigeon 2 and Canivore with Falcons, Cancoders and Pigeon 2. All other CAN devices are running on the Roborio CAN interface.

VikoticRlink commented 1 year ago

We are having the exact same issue. Our configuration is identical (Mk 4i) and a Rio2. I've increased the delay, but am still getting this occasionally. One thing I am seeing in the log files is a overrun error in robotPeriodic.

ritchiedc commented 1 year ago

@VikoticRlink I added a new delay before the module objects are created.

VikoticRlink commented 1 year ago

@ritchiedc We did that too, 3 sec delay. we are still seeing it, and it is cropping up in different modules. We are going back to pre-alligning our wheels for safety sake

ritchiedc commented 1 year ago

@VikoticRlink There was one other thing we did that was part of "the kitchen sink" we threw at the problem. To be honest I didn't think it was the solution but we also didn't remove it. I'm still not sure it was our solution but here it is if you want to try. In resetModulesToAbsolute we reset module 3 a second time after the loop. Not knowing if there is any buffering this was an attempt to "flush" it.

VikoticRlink commented 1 year ago

@ritchiedc we are still testing new code for dcmp and are noticing different modules. I'll throw it in again after the delay.

ritchiedc commented 1 year ago

@VikoticRlink we only added that last piece because it only happened with module 3 which is the last one to be reset. I probably wouldn't have considered it if other modules were involved.