Swerve not understanding direction

Hello we are a rookie team, Bluebotics 6150, this is my second year competing in FRC. We decided to try out Swerve drive this year, our main issue is that our wheels don’t understand what direction to move in they move in the same direction for a little bit and then start turning right or left at random. We have the default Java code from the WPILib website, any advice would be much appreciated.

I’m not a programmer, but from experience, I would recommend “sanity checking” what units you’re using first. I’ve seen a lot of swerve drive issues happen because someone thought they were working in degrees when the code is actually in radians (or vice-versa).

Also, what swerve drive modules are you using out of curiosity? There may be specific code examples for them that are easier than WPILib in some cases.

I don’t have the information on hand at the moment I can get back to you later today.

rev-21-1650

That’s the motor, are you using a custom swerve module or an off the shelf one like this, this, or this, and if so, which one?

A discontinued Andy Mark Swerve and Steer Module

Ahh, ok, it makes sense you might have some trouble with that since they’re not developing those anymore. I also know a number of teams that have had issues with those modules before.

What kind of position sensors do you have on that? If you’re using the MA3 Absolute encoder you should be fine (electrically, at least), but the others might be more problematic to use, especially with stock WPILib code. My expertise ends at the hardware-end of things, but I’ll forward this to our programmers to see if they have any input that might help you.

Had you asked this question 6 weeks ago, I would have honestly advised you that rookie teams should avoid swerve and save it for an off-season project (we spent 2 years with a practice swerve bot before fielding our first one last year), but I’m guessing at this point it’s too late to change that decision so hopefully people here can get you something usable. Worst-case scenario, you can always lock the modules and run it as a 4 wheel tank drive if you run out of time.

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