Skip to content
This repository was archived by the owner on Aug 29, 2024. It is now read-only.

Created the basic code for the driver controlled swerve drive#9

Open
ethanharjabrata wants to merge 40 commits intomainfrom
7-driver-controlled-swerve-drive
Open

Created the basic code for the driver controlled swerve drive#9
ethanharjabrata wants to merge 40 commits intomainfrom
7-driver-controlled-swerve-drive

Conversation

@ethanharjabrata
Copy link
Contributor

Some values need updating:
Motor channels
Encoder channels
DistancePerPulse

Some values need updating:
Motor channels
Encoder channels
DistancePerPulse
@ethanharjabrata ethanharjabrata linked an issue Jan 28, 2024 that may be closed by this pull request
@ethanharjabrata
Copy link
Contributor Author

@WebCoder49 can you review this

ethanharjabrata and others added 2 commits January 28, 2024 17:15
Code used to find out the distance per pulse of the robot
@WebCoder49
Copy link
Member

This looks good to me! We can merge this when we have tested it.

Copy link
Member

@WebCoder49 WebCoder49 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

WebCoder49 and others added 7 commits January 31, 2024 16:40
Make build.gradle errorless
Created the code for the motors, but I haven't bound the snap function to a button yet.
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)
Forgot to update the robotContainer
// Called when the command is initially scheduled.
@Override
public void initialize() {
//tuning the PID constants
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Member

@WebCoder49 WebCoder49 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for this! However, please see my PID tuning comment.

@WebCoder49
Copy link
Member

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.
ethanharjabrata and others added 10 commits February 15, 2024 12:50
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
@WebCoder49
Copy link
Member

If there were no further problems while testing, you can merge this, @spamtactics .

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Driver-controlled swerve drive

3 participants