-
Notifications
You must be signed in to change notification settings - Fork 0
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
Path following #10
Path following #10
Conversation
Signed-off-by: Samuel Villegas <[email protected]>
Dev Note |
Dev Note |
Dev Note Added some counter skew into So, this takes the current position of the robot & calculates the desired position from demanded speeds and takes the double looper = .25;
Pose2d currentPose = getCurrentPose();
Pose2d desired = new Pose2d(currentPose.getX() + (speeds.vxMetersPerSecond *
looper),
currentPose.getY() + (speeds.vyMetersPerSecond * looper),
currentPose.getRotation().plus(Rotation2d.fromRadians(speeds.omegaRadiansPerSecond
* angle_looper)));
Twist2d twist_vel = currentPose.log(desired);
ChassisSpeeds updated_speeds = new ChassisSpeeds(twist_vel.dx / looper,
twist_vel.dy / looper,
twist_vel.dtheta / looper); |
…l gyro drift fix using angular rate
Added gyro update rate into angular calculations to hopefully solve the issue. However, I might need to look at pid error first otherwise the issue will need to be dropped. chiefdelphi post on field relative drift. |
…rated to autobuilder
Dev Note So as of commit 3ec6647 the position drift has been mostly corrected the next step is to tune the I ended-up using linear regression to calculate the slope for robot distance and added it to the end of @Override
public double getDrivePosition() {
/*
* I'm going to remove factor 0f 42 to see if the converion is done by revlib
* already
*/
return (((driveMotor.getEncoder().getPosition()) * Constants.ModuleConstants.kDriveMotorGearRatio)
* (Constants.ModuleConstants.kWheelDiameterMeters * Math.PI)) * (1 / 1.305);
} This means we are missing something when we calculate the robot position. However, currently it makes more sense to run with this solution instead of hunting down this issue. Otherwise, the next step is to calculate the standard deviation of the drive encoders to tune our |
Changes Introduced
AutoBuilder
last in theSwerveSubsystem
constructor and created a new constant calledkPathFollowerConfig
. This centralizes the follower config in one place and defines the PID controllers for x & y axes, not to mention the drivetrain constraints.FollowPathCommand
togetAutonomousCommand
to execute the path from pathplanner inRobotContainer
.