Created the basic code for the driver controlled swerve drive#9
Created the basic code for the driver controlled swerve drive#9ethanharjabrata wants to merge 40 commits intomainfrom
Conversation
Some values need updating: Motor channels Encoder channels DistancePerPulse
|
@WebCoder49 can you review this |
|
This looks good to me! We can merge this when we have tested it. |
Make build.gradle errorless
Add swerve drive subsystems
It is bound to button 1 on the Joystick
Includes code so that the robot can update its PID. Also allows the robot to offset the encoders such that they will be field oriented (assuming that the robot starts facing the field)
| // Called when the command is initially scheduled. | ||
| @Override | ||
| public void initialize() { | ||
| //tuning the PID constants |
There was a problem hiding this comment.
I'm not sure about this - it seems that you've got each coefficient in a separate Shuffleboard tab; saving them in DriveConstants ones as defaults would be useful too.
WebCoder49
left a comment
There was a problem hiding this comment.
Thank you for this! However, please see my PID tuning comment.
…trolled-swerve-drive
7 driver controlled swerve drive
|
Thank you for this! After being told to do so by engineers in testing, I have set the encoders to be fetched from the SparkMAXs - that is our setup, for future reference. Also, @spamtactics, it appears you occasionally understandably use C# naming conventions - please could you stick to camelCaseLikeThis rather than PascalCaseStartingWithACapitalLetter for class fields, methods, and parameters? |
Changed it so that the new bearing will only update if the joystick points in a direction that would probably result in a new snap heading.
I changed it such that the encoder will actually tell you the distance moved since the last time it was called, not the total distance moved as this would be problematic if you were using two different commands during that time. I have also used two different constants, distancePerRotation meaning the circumference of the motor. movementPerRotation meaning the actual distance travelled by the robot when the move motors rotate once.
Update snap-to-90deg code with swerve drive
|
If there were no further problems while testing, you can merge this, @spamtactics . |
reload this to use the robotBearingController that has a continuous input
…trolled-swerve-drive
Some values need updating:
Motor channels
Encoder channels
DistancePerPulse