MK4 drift

We are here again and are pulling our hair out trying to fix this. The problem we keep running into is that after aligning the modules they drift causing the robot to move straight but the chassis rotates slightly as it moves.

What we are using, MK4 L1, with Swervelib 1.1.0, we are on the newest version of ctre, rev, wpi, and ni, our gyro is a crte pigeon v1

Our process:

  • Set robot on its back
  • Set offsets to 0
  • Align modules (we used wood, square, eyes, fingers. We used them alone and all at once)
  • Drive robot while it’s still on its back, to check modules
  • Set robot on its wheels
  • weep as it still drifts after attempt #15334

What we’ve notice

  • when the modules move around for a bit they all become offset slightly and no longer return to their proper home position

We are dead in the water until this gets fixed, we have no clue where to go from here.
Any help at all will be appreciated.

1 Like

Are the magnets secured (glued) in?

Yes, the modules CANcoder magnets are secured with glue

1 Like

I suggest debugging by putting encoder values on smartdashboard to see if the wheels are actually reaching the right tick count

I’m not entirely sure I understand, Get the encoders positions and compare to what the module thinks their at?

Are the CANCoders blicking with the right light pattern? (Are the indicating a magnet problem?)

I mean tell the modules to go the the 0 position, write down the numbers from encoders, later do same thing and if:

  • numbers are different & position is looking different - PID tuning issue likely
  • numbers are same & position is looking different - Encoder hardware issue

I know 3 of them are green and 1 of them are orange, build couldn’t get the last one to turn green, so it’s slightly off but still within acceptable error according the the ctre docs

If it’s a PID issue Im unable to fix that swervelib doesn’t let you change the PID values to my knowledge, but I will run the test now

The encoders return a value ±1 degree off which should not explain the amount of drift we are seeing

This has to be a hardware problem. Do all or just 1 module drift?

Depends, all 4 some days, only 1 other days

Are you sure the encoder are not losing power at any point or the can bus being lose?

I dont see any CAN errors about loss of signal or too stale frames, and the encoders don’t flicker red/off at any point

Are you using field oriented drive? Is the Pigeon drifting?

1 Like

Something else we have just noticed is that some of the modules seem to spin slightly faster than other modules, this might be our problem

How are you getting the encoder values for the steering motors? Our robot is configured so the FalconFX uses the CANCoder as a remote sensor. I had one module consistently off and finally found that the call to get the selected sensor position wasn’t getting the absolute position of the CANCoder, and I had to set the position using the setPositionToAbsolute method on the CANCoder during initialization.

If you aren’t using the CANCoder directly, how are you calculating the steer position?

We are and the pigeon has been very accurate, we have seen minimal gyro drift and is definitely within acceptable error. But the robot’s forward doesn’t drift, the chassis does.

1 Like

are you seeing carpet drag where one or more wheels are just completely useless and being dragged (usually pointed in wrong direction)

Swervelib is supposed to be handling all of that, but from browsing the repo it seems to be setting the remote sensor of the rotation motor to the module encoder

Here is the link to that part of the repo

I feel at this point it may be an issue with the repo, rather than something physical.