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

add drive command with smoother inputs #36

Merged
merged 8 commits into from
Nov 19, 2024
Merged

add drive command with smoother inputs #36

merged 8 commits into from
Nov 19, 2024

Conversation

linglejack06
Copy link
Member

  • square linear velocity while retaining direction of x and y
  • square omega input using Math.copySign to retain direction
  • rename wpi_interface to wpilib_interface

@linglejack06 linglejack06 self-assigned this Nov 12, 2024
Copy link
Member

@jkleiber jkleiber left a comment

Choose a reason for hiding this comment

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

Just one comment. Any sim evidence would be good before we put this on the robot

Comment on lines 35 to 45
double deadband = Deadband.oneAxisDeadband(Math.hypot(x, y), 0.1);

Rotation2d direction = new Rotation2d(x, y);
double squaredMagnitude = deadband * deadband;

Translation2d linearVelocity =
new Pose2d(new Translation2d(), direction)
.transformBy(new Transform2d(squaredMagnitude, 0.0, new Rotation2d()))
.getTranslation();

return linearVelocity;
Copy link
Member

Choose a reason for hiding this comment

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

This logic is sus to me, and definitely needs to be tested

If it works, we will need some comments added to explain the logic and why it works

@linglejack06 linglejack06 merged commit 158b251 into main Nov 19, 2024
11 checks passed
@linglejack06 linglejack06 deleted the drive-command branch November 19, 2024 00:29
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.

2 participants