centripetal correction
This commit is contained in:
@ -433,6 +433,7 @@ public class Follower {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!teleopDrive) {
|
if (!teleopDrive) {
|
||||||
|
if (currentPath != null) {
|
||||||
if (holdingPosition) {
|
if (holdingPosition) {
|
||||||
closestPose = currentPath.getClosestPoint(poseUpdater.getPose(), 1);
|
closestPose = currentPath.getClosestPoint(poseUpdater.getPose(), 1);
|
||||||
|
|
||||||
@ -486,6 +487,7 @@ public class Follower {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
velocities.add(poseUpdater.getVelocity());
|
velocities.add(poseUpdater.getVelocity());
|
||||||
velocities.remove(velocities.get(velocities.size() - 1));
|
velocities.remove(velocities.get(velocities.size() - 1));
|
||||||
@ -851,7 +853,7 @@ public class Follower {
|
|||||||
curvature = (yDoublePrime) / (Math.pow(Math.sqrt(1 + Math.pow(yPrime, 2)), 3));
|
curvature = (yDoublePrime) / (Math.pow(Math.sqrt(1 + Math.pow(yPrime, 2)), 3));
|
||||||
}
|
}
|
||||||
if (Double.isNaN(curvature)) return new Vector();
|
if (Double.isNaN(curvature)) return new Vector();
|
||||||
centripetalVector = new Vector(MathFunctions.clamp(FollowerConstants.centripetalScaling * FollowerConstants.mass * Math.pow(MathFunctions.dotProduct(poseUpdater.getVelocity(), MathFunctions.normalizeVector(currentPath.getClosestPointTangentVector())), 2) * curvature, -1, 1), currentPath.getClosestPointTangentVector().getTheta() + Math.PI / 2 * MathFunctions.getSign(currentPath.getClosestPointNormalVector().getTheta()));
|
centripetalVector = new Vector(MathFunctions.clamp(FollowerConstants.centripetalScaling * FollowerConstants.mass * Math.pow(MathFunctions.dotProduct(poseUpdater.getVelocity(), MathFunctions.normalizeVector(currentPath.getClosestPointTangentVector())), 2) * Math.abs(curvature), -1, 1), currentPath.getClosestPointTangentVector().getTheta() + Math.PI / 2 * MathFunctions.getSign(currentPath.getClosestPointNormalVector().getTheta()));
|
||||||
return centripetalVector;
|
return centripetalVector;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user