Skip to content

Odometry when tilted -> master#174

Draft
DanielShapir wants to merge 7 commits into
masterfrom
odometry-when-tilted-design
Draft

Odometry when tilted -> master#174
DanielShapir wants to merge 7 commits into
masterfrom
odometry-when-tilted-design

Conversation

@DanielShapir
Copy link
Copy Markdown

No description provided.

@DanielShapir DanielShapir self-assigned this Mar 2, 2026
@DanielShapir DanielShapir marked this pull request as draft March 2, 2026 23:34
Comment thread src/main/java/frc/robot/odometry/OdometryPlus.java Outdated
Comment thread src/main/java/frc/robot/odometry/OdometryPlus.java Outdated
Comment thread src/main/java/frc/robot/odometry/OdometryPlus.java Outdated
/**
* Constructs an Odometry object.
*
* @param kinematics The kinematics of the drivebase.
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Suggested change
* @param kinematics The kinematics of the drivebase.
* @param kinematics The kinematics of the chassis.

לא מכירה שימוש בdrivebase אבל אולי אני טועה

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

huh?

Comment thread src/main/java/frc/robot/odometry/OdometryPlus.java Outdated
Comment thread src/main/java/frc/robot/odometry/OdometryPlus.java Outdated

Transform2d delta = new Transform2d(lastPose, rawPose);

Pose2d corrected = lastPose.plus(new Transform2d(delta.getTranslation().times(scale), delta.getRotation()));
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Check math in main pls

Comment thread src/main/java/frc/robot/odometry/OdometryPlus.java Outdated
Comment thread src/main/java/frc/robot/odometry/OdometryPlus.java Outdated
// in case angle above 90 so wont minus , i dont think pose is relevant when robot flips
double scale = Math.max(0, Math.cos(angles.rotateBy(new Rotation3d(0, 0, -angles.getZ())).getY()));

Transform2d delta = new Transform2d(lastPose, rawPose);
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Better name

Comment thread src/main/java/frc/robot/odometry/OdometryPlus.java Outdated
Comment thread src/main/java/frc/robot/odometry/OdometryPlus.java Outdated
Transform2d unCompensatedDistance = new Transform2d(lastPose, unCompensatedPose);

Pose2d compensatedByPitch = lastPose
.plus(new Transform2d(unCompensatedDistance.getTranslation().times(scale), unCompensatedDistance.getRotation()));
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

consider just doing
unCompensatedDistance.times(scale)

Comment on lines +44 to +45
if (robotOrientationSupplier == null)
return unCompensatedPose;
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Why check if null?
Why not check if everything else is null?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

outdated
already changed the whole thing

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

have no time to update it right now

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.

5 participants