Skip to content

Commit

Permalink
moved velocity calculations to the localizers
Browse files Browse the repository at this point in the history
  • Loading branch information
AnyiLin committed Nov 21, 2024
1 parent 9711a26 commit 089fc3a
Showing 1 changed file with 4 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -262,9 +262,10 @@ public Pose getDeltaPose() {
*/
public Vector getVelocity() {
if (currentVelocity == null) {
currentVelocity = new Vector();
currentVelocity.setOrthogonalComponents(getPose().getX() - previousPose.getX(), getPose().getY() - previousPose.getY());
currentVelocity.setMagnitude(MathFunctions.distance(getPose(), previousPose) / ((currentPoseTime - previousPoseTime) / Math.pow(10.0, 9)));
// currentVelocity = new Vector();
// currentVelocity.setOrthogonalComponents(getPose().getX() - previousPose.getX(), getPose().getY() - previousPose.getY());
// currentVelocity.setMagnitude(MathFunctions.distance(getPose(), previousPose) / ((currentPoseTime - previousPoseTime) / Math.pow(10.0, 9)));
currentVelocity = localizer.getVelocityVector();
return MathFunctions.copyVector(currentVelocity);
} else {
return MathFunctions.copyVector(currentVelocity);
Expand Down

0 comments on commit 089fc3a

Please sign in to comment.