Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Test/drive cv alignment #14

Open
wants to merge 62 commits into
base: main
Choose a base branch
from
Open

Test/drive cv alignment #14

wants to merge 62 commits into from

Conversation

AknA13
Copy link
Contributor

@AknA13 AknA13 commented Nov 7, 2023

Has a method for driving to a specific (x,y,angle) using encoder-gyro odometry

src/main/java/frc/robot/Robot.java Show resolved Hide resolved
&& Math.abs(rotAmount) < AutoConstants.DEGREES_MARGIN_OF_ERROR) {
drive(0, 0, 0, false, false);
} else {
double xSpeed = xDist / AutoConstants.DRIVE_TO_TAG_TRANSLATIONAL_CONSTANT;
Copy link
Contributor

Choose a reason for hiding this comment

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

I think for swerve you want to control for the overall speed, not the speed of the individual axes. In other words, the magnitude of the velocity vector. Otherwise you'd be sqrt(2) faster if the direction to the target happens to be on a diagonal.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It shouldn't matter because our x and y components of this speed vector are proportional to how far we need to move to get to our target coordinates, right? Because the drive() function in our swerve method accepts the xSpeed, ySpeed, and angularSpeed as parameters, we can't simply use the magnitude.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants