Hello and Merry Christmas! Our team just bought the SDSSwerve Drive Specialties Mk4i swerves, and I need help programming them. I found this YAGSL Example and this YAGSL Working Configs and set up the YAGSL example code with my version of the working configs in this repository: My repo. However, I need help configuring the swerves correctly because they aren’t working properly. When I move the left joystick to the right or left, the swerves seem to go to a different offset value, so there seems to be 2 offset values. However, if I wanted to drive the robot straight or backwards it would work just fine, but when I turn it past a certain threshold (I’m thinking 90 degrees) that’s when issues occur. I can turn it just fine about 90 degrees in both directions but anything more and it goes to the different offset value. Once the swerves are in that incorrect offset value, that’s when I can touch the left joystick and it goes to the correct offset value, as seen in this video. They seem to be moving on their own as well, trying to find the 2 offsets. All of the swerves are acting the same as well. The id’s have been set correctly, and the offsets should be correct. We use NEO 1.1’s, CanandCoder connected to SparkMax data port, and NavX IMU. I would appreciate any and all help, thank you!
It’s hard to tell from your video what issue you are experiencing. What direction does the robot try to go in when going left or right?
Also it looks like all of your CanAndCoders are set to id 0 are they directly attached to a Sparkmax?
The direction is the opposite. When I go left the robot goes right and vice versa. If I inverted the angle, they randomly shake, so there has to be another solution to that. The CanAndCoders are attached to the SparkMax
Try inverting your IMU. Uninvert or invert
Nvr mind about changing them to attached
I tried changing them to attached and they started spinning randomly. The IMU is inverted, I can try changing the value to false
Whether the IMU is inverted or not doesn’t seem to have any visible effect. One of the main issues is that when I’m not touching the controller, they move to the offset position and then stop moving when they get there. Here is another video if it helps: video link
Are your module positions correct?
Do you mean the absolute encoder offsets? They should be correct, yes. The locations (x and y) of the swerves should be correct as well
If everything is correct invert the direction of your controller
What should I do after this? Also, when I move the right joystick to the right, the swerves don’t turn they just go forwards, and if I move it to the left, they go backwards. Shouldn’t the right joystick be used for turning with YAGSL?
Is there a working YAGSL config for a robot with NEOs, Spark Maxs, NavX, CanAndCoders, and Mk4i swerves? I have found some that are similar from repositories forked from the YAGSL Example, but not one with our exact specifications. I appreciate the help!
Anybody has any update on this thread
?
This sounds like a joystick issue! You are probably using the wrong axis in your code.
Hello! Quick update here: We got the robot working with YAGSL. For anyone who is using SDS Mk4i swerves, NEO 1.1’s, CANandCoders, and a NavX IMU, here are the JSON files we configured:
Back Left Module.json (414 Bytes)
Backright module.json (415 Bytes)
Front Left Module.json (413 Bytes)
Frontright module.json (414 Bytes)
physicalproperties.json (261 Bytes)
pidfproperties.json (176 Bytes)
controllerproperties.json (170 Bytes)
swervedrive.json (201 Bytes)
Thanks to YAGSL, all you have to do is go to the YAGSL Example, read the docs to understand how it works, and use these JSON files and you should be good to go. If the YAGSL example doesn’t work, I have found that some of the forks on the repo work. If you have any issues, RobotContainer would be my first place to look, it might help to use field oriented drive instead of robot relative drive as well. Our Robot Container looks like this: RobotContainer.java (6.3 KB). I hope this helps!
This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.