acmerobotics / road-runner

Wheeled mobile robot motion planning library designed for FTC
MIT License
209 stars 75 forks source link

plus and minus #67

Closed Team14423 closed 3 years ago

Team14423 commented 3 years ago

Does Pose.2d (and Vector2d) plus and minus alter the original Pose2d object? That is if I do:

Pose2d oldPose = new Pose2d(0,0,0); Pose2d newPose = oldPose.plus(0,4,0);

then new Pose ought to be 0,4,0, but oldPose is still (0,0,0) - do I have that right?

We are using Learn Road Runner's terrific align to point code, but instead of aligning on the center of the robot, we are creating a new pose that's shifted over 4 inches or so (where the center of our shooter is). That works great, except that our heading is now changing over time and we want to verify that it's not because we're accidentally changing our poseEstimate by 4" every time we go into this mode.

rbrott commented 3 years ago

Does Pose.2d (and Vector2d) plus and minus alter the original Pose2d object? That is if I do:

Pose2d oldPose = new Pose2d(0,0,0); Pose2d newPose = oldPose.plus(0,4,0);

then new Pose ought to be 0,4,0, but oldPose is still (0,0,0) - do I have that right?

Yes, poses and vectors are immutable. The oldPose value will remain as (0, 0, 0).

Team14423 commented 3 years ago

Thanks!