Hello, I am leading my teams programming development of our swerve drive. It uses thrifty v2 modules with vortexes, cancoders, and a pigeon. This is our first time ever working with swerve (and my first time programming for first) and a lot of the questions (and follow up questions) may sound dumb, so sorry in advance. Right now we’ve deployed code to the frame, our code is the same as the example code from bronc bots, with the json files altered, which I will give a link to. Right now, our modules move uncontrollably and initially on their own. When I fiddle around with the right joystick, the modules stop but then when I control the robot it moves uncontrollably again, I have a video linked here as well. Another thing to note we did is invert the drive motors on the right side of our robot cuz they were moving in the opposite direction. We’re trying to tune our pid values but we see no improvement. We had a few questions that might help us solve the problem, but we are open to any other suggestions. 1. Is the zero position of our frame supposed to be set with the modules facing forward and the bevel gears facing to the left, or are the encoders supposed to be zeroed when the wheels are in their turning position and at a 45 degree angle? Also, in regards to finding values on shuffleboard for finding inversions, we found that all values in the network tables only return a datatype and never any values when we enable the robot. Finally, do you guys think the issue at hand has something to do exclusively with PID tuning, or is it possibly an inversion issue as well?
This is bc you are using the directAngle drive command, switch to angularVelocity for now. directAngle tries to align the robot to the same way you push your right joystick too, if you rotate the robot it will slow down and speed up.
As an FYI, i cannot help further until you link your full code not just the deploy directory. So the best i can give you is a link to the angularVelocity command and hope that you use it!
I changed the drive command and it’s working a lot smoother, some of the modules start spinning uncontrollably when I change direction but I think this is a PID issue. The main issue right now is that when I rotate the robot with the right joystick, the motors face inwards, and some of them face forward. The Pigeon orientation is correct and all of the cancoders were zeroed when the wheels were in their rotation position like this:
/
/
We tried this and it worked, somewhat. We changed the front of the robot, and all the modules move in their expected direction except for one. The backleft module and frontright module work perfectly, the front left module rotates in the right direction, but it goes in the opposite direction then where it’s supposed to. The backright module is moving towards the inside of the robot like this:
/\
\\
We’re not really sure whether or not we should switch the modules around because everything else is moving the right way, except for the front right module as we said which drives the opposite direction which we will just add a drive invert to to fix. Thank you so much for helping us again.
Yeah I wasn’t really thinking on that one… I just did the inversions just now according to the values displayed on shuffleboard (I got the values displaying now). Right now, the front left module is moving in the right direction and so is everything else, except for the back right module that’s going the same direction that I showed before.
Sorry I think I might’ve misunderstood and forgot to answer your question. Yeah, I confirmed that all the control id’s are in their correct physical position. In terms of module configuration, I’m not sure exactly whether or not to move the positions of the modules around because three of them work as intended (granted I had to invert two drive motors because the encoder values were decreasing when rotated counter clockwise) and if I were to switch the one module that wasn’t functioning correctly with another one, there would still be one that isn’t working correctly. I was looking at the flow chart and at the module again and I realized that it wasn’t fully facing diagonally towards the center of the robot. Idk if I’m explaining what it looks like well here but I suspect maybe this could be an encoder offset issue? I haven’t fully tuned the offset yet and looking at the configuration part of yagsl I think this could be the issue. I’ll try it and let you guys know what happens
Update: we adjusted offset and the modules are all working a lot better, except for the back right module again. At the beginning it moved in the same direction as the other wheels but then as you move the left joystick around it becomes less and less aligned until it’s perpendicular to the other wheels. Here’s a video showing it, there is some jittering which we think is just because we didn’t fully tune our pid values. https://drive.google.com/file/d/1M0hm4R5wImb4-tIpT5LNWQRwJP7KFa3Z/view?usp=drivesdk