YAGSL Swerve Drive Rotation Issue

Okay, our team is re-doing our swerve drive here in the off season. We decided to give YAGSL a go, and so far are having a good experience. We have gotten stumped as of recently on the rotation.

We use an Xbox One controller, and right now it can go the normal x and y directions just fine, but when we use the other joystick to start rotating, the robot will just infinitely rotate in that direction. If you change directions it will change, but it is still infinite. It’s like the joystick just toggles the direction.

Anybody got any ideas on where to look?
We are currently thinking it could be related to the deadband? Or possible PIDs? We aren’t exactly sure, hence the post…

Our code is here: GitHub - quackattack4181/neo-swerve-custom-yagsl

It’s a copy of the YAGSL Example for now. Just have been editing the JSON files for our robot specifically.

We are using the following:
Drive Motors: NEO’s
Angle Motors: NEO’s
Motor Controllers: ALL SparkMAX’s
Absolute Encoders: CANCoder’s
Gyro: NavX2 through the SPI Serial port on the roboRIO

Happy to answer questions. And any feedback / Insights would be greatly appreciated.

Thanks, Team 4181.

Wheel Modules: SDS MK4i’s

I would encourage you to take a look here: Flowcharts | YAGSL *Wrong link this is updated

Most likely your gyro is inverted :smiley:

1 Like

Hi! Can you please check the reading of your gyros? That might be the issue.

Since you haven’t modified the swerve code, I assume you are using YAGSL’s default drive command.

The rotational stick is not used to “spin” the robot in the default drive command. Instead, the rotation axis directly controls the “facing” of a robot. The robot rotates to the specified direction using a PID controller. For example, if the rotation stick points to the left, the drivetrain will automatically face toward the “left.”

So, if the gyro is not connected correctly and its reading is consistently zero, the robot will never reach the desired heading and spin infinitely.

To build off of this check the dip switches on the navx, make sure spi is on. I believe UART can be off.

1 Like

Okay we thank all of you for the help. Our Gryo wasn’t being detected properly, and was inverted. that problem ahs been solved. Now our only problem is that the right joystick. (The one for orientating which way the robot faces) is inverted.

2 Likes