NeoSwerve Trouble

For some reason our code decided to blow up today. We never got the absolute to work correctly but we got by with realigning every power cycle. Today for some reason even the realign is not working either.

We are using
Neos
mk4is
CanCoders
Pigeon 2.0

Any help would be apreciated.
TeleopSwerve.java (1.9 KB)
SwerveModule.java (6.1 KB)
Swerve.java (4.7 KB)

Further details on the observed behavior, expected behavior, things you have tried, etc. Would be helpful in trouble shooting. Bonus points for video/pictures of an error.

(Just trying to get some more details and have an objective reference for anyone trying to help)

Sorry I’m very new to this.

The swerve tends to move correctly when we directly align the wheels as I said before. But when not adjusting the wheels trying to use the absolute boot feature the angle motors get all out of wack. We do have the encoders set to boot absolute in both the config file and on phoenix tuner. I did find a thread talking about this exact issue previously but it appeared to me that our swerve base already had this implemented. We have tried to wait a while just to make sure the encoders boot correctly but with no success. Not really sure what else to try. One thing worth noting is if we deploy robot code we always have to power cycle the bot and realign. Not really sure what else to try.

You guys should check out YAGSL

Maybe it can give you an idea as too what’s going on.

1 Like

I have never seen this before. I’ll try it first thing tomorrow. Thank you!

Here are some resources for it to help you get started!

Quick question. If I use the example do I just have to change the deploy/swerve files. Do you need to do anything else or does it just work?

You do need to change the deploy/swerve files. These files configure your swerve drive entirely, like your motor ID’s, absolute magnetic encoder offsets, imu ID, etc. We made a easier configurator at YAGSL Tuning Webpage which eleveates some of the headaches of generating the configs.

The default drive scheme in YAGSL-Example is designed to test the swerve drive and is sub-optimal for competition use. The left stick controls translations in the x and y direction. The right stick controls the heading of the robot. If everything is tuned correctly this will work. If this works then your autonomous should work too if you configured the heading PID with the same one as your config files.

There are some inversion difficulties too teams with Falcon’s have experienced, for example you may need to set p in controllerproperties.json to negative if invertIMU in swervedrive.json doesn’t work. Or you may need to set p in pidfproperties.json to negative if inverting the drive motors causes issues with odometry.

I have documented every feature I could in the features discussion it also includes information on how the library should be used and how to use the features.

The good news is they are using NEOs , with Cancoders and pigeon.
This is why I recommended YAGSL because they didn’t have falcons.
They’ll need to identify and plug in the IDs to there moters in the corresponding json files in the deploy folder.

I found an issue. I run into this when deploying.

Driver station says no code.
Any solutions?

The stack trace says FileNotFoundException: /home/lvuser/deploy/swerve/neo/swervedrive.json meaning you are trying to access your configs from /home/lvuuser/deploy/swerve/neo AKA deploy/swerve/neo which doesn’t exist or have the files in it.

Ok I fixed that I think. However a new really weird error code popped up.

That is because I accidentally left in something I never implemented because it was fixed later (encoder inversion). If you regenerate your module configs from the tuner page in a moment that will fix it. If you want to modify each module json remove the encoder entry from the inverted dictionary.

Thank you for letting me know about the error, sorry you experienced it!

It seems to be that the pigeon 2 “type” is broken. I can’t tell if its my error but every time I deploy I get a PigeonIMU error. I do have the “id” field set as my can id and the “canbus” field set to null.

Can you send me a screen shot? I use the pigeon2 on ours right now.

Screenshot 2023-02-28 182332


This is both fields.

Null is not supposed to be in quotes, null means that its not on an alternate CANBus and is not a string type. With it as a string you are trying to use the CANBus named “null”

Ok sorry I missed that. Now we are having crazy amounts of rotation on the wheels. Like out of control.

Can you please link to your code?