-
Notifications
You must be signed in to change notification settings - Fork 222
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
Fixes the resetOdometry method #142
Fixes the resetOdometry method #142
Conversation
…ld pass in the gyro angle. Without this fix, it is impossible to start the robot in autonomous with a non-zero pose angle.
If i remember correctly i use the Pose2d rotation because i wanted to be able to test in sim. I will have to look into wpilib docs about this tomorrow. Thank you for your contribution! |
Sounds good! I found the problem using sim. If you start with a trajectory where the robot heading is at 180 degrees, that initial pose gets removed because the gyro offset does not get set right in the SwervePoseEstimator. |
Hmmm, i think i need a |
That way i can set the current orientation of the robot without it actually shifting it's 0 to it. Can you add that to this PR and I will merge it then? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This removes the ability to set rotation in odometry so we should ensure that the ability is maintained by adding a new function SwerveDrive.setHeading
.
The SwerveDrivePoseEstimator is designed to not require the user to manually offset the gyro The docs comment for
I dug through it last night and when you call If you pass in the desired pose to the first argument, then it assumes that the offset is 0 because the heading from the gyro and desired pose are the same. |
Quick follow-up, I think I misunderstood your thinking. You would like to have an explicit method to set the yaw for testing, like in sim? |
The heading from the gyro and desired pose arent always the same? Especially if the robot was turned on while 0 was not correct. I have a function which resets the odometry using the first pose. |
Yes, I think Any calls to We could add a |
I agree, could you make that change for |
Before, this method returned the raw gyro reading. This could result in getHeading and getPose returning different values.
I added a second commit that modifies If this ends up testing correctly, I can also do a quick PR to change |
I just tested and did the same. It doesnt fix what I would like it to however it is a good change. |
Quick question, what other issues are you seeing? I can be on the lookout for them in our testing. |
The call to swerveDrivePoseEstimator.resetPosition should pass in the current gyro angle as the first argument.
Without this fix, it is impossible to start the robot in autonomous with a non-zero pose angle.
Thanks for YAGSL!