-
Notifications
You must be signed in to change notification settings - Fork 105
Bugfix/fix capture region and rate limit #1110
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -417,8 +417,7 @@ private void submitSolverTaskConditions(FrameConvexPolygon2DReadOnly supportPoly | |
|
|
||
| UnrolledInverseFromMinor_DDRM.inv(transformedGains, inverseTransformedGains); | ||
|
|
||
| solver.resetCoPFeedbackConditions(); | ||
| solver.resetFeedbackDirection(); | ||
| solver.resetFeedbackConditions(); | ||
| solver.setFeedbackConditions(scaledCoPFeedbackWeight, transformedGains, dynamicsObjectiveWeight.getValue()); | ||
| solver.setMaxCMPDistanceFromEdge(maxAllowedDistanceCMPSupport.getValue()); | ||
| solver.setCopSafeDistanceToEdge(safeCoPDistanceToEdge.getValue()); | ||
|
|
@@ -442,6 +441,11 @@ private void submitSolverTaskConditions(FrameConvexPolygon2DReadOnly supportPoly | |
|
|
||
| solver.setMaximumFeedbackRate(feedbackGains.getFeedbackPartMaxRate(), controlDT); | ||
| } | ||
| else | ||
| { | ||
| solver.removeMaximumFeedbackMagnitude(); | ||
| solver.removeFeedbackRateLimit(); | ||
| } | ||
|
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Previously, what happened is that we wouldn't add the magnitude limits or rate limits if it was in a reset. However, those values were never getting reset inside the ICPControllerQPSolver. So it was applying whatever they were the last time they were set. So we were never actually removing these constraints. |
||
| ignoreRateLimitThisTick = false; | ||
|
|
||
| double feedbackRateWeight = usingHighCoPDamping.getValue() ? highlyDampedFeedbackRateWeight.getValue() : this.feedbackRateWeight.getValue(); | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -294,6 +294,18 @@ public void setMaximumFeedbackRate(double maximumFeedbackRate, double controlDT) | |
| this.controlDT = controlDT; | ||
| } | ||
|
|
||
| public void removeFeedbackRateLimit() | ||
| { | ||
| this.maximumFeedbackRate = Double.POSITIVE_INFINITY; | ||
| } | ||
|
|
||
| public void removeMaximumFeedbackMagnitude() | ||
| { | ||
| CommonOps_DDRM.setIdentity(maxFeedbackTransform); | ||
| maxFeedbackXMagnitude = Double.POSITIVE_INFINITY; | ||
| maxFeedbackYMagnitude = Double.POSITIVE_INFINITY; | ||
| } | ||
|
|
||
| /** | ||
| * Zeros all the pertinent scalars, vectors, and matrices for the solver. Should be called at the beginning of every computation tick. | ||
| */ | ||
|
|
@@ -357,6 +369,15 @@ private void reshape() | |
| solution.reshape(problemSize, 1); | ||
| } | ||
|
|
||
| public void resetFeedbackConditions() | ||
| { | ||
| resetCoPFeedbackConditions(); | ||
| resetCMPFeedbackConditions(); | ||
| resetFeedbackDirection(); | ||
| removeFeedbackRateLimit(); | ||
| removeMaximumFeedbackMagnitude(); | ||
|
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. we were never calling "resetCMPFeedbackConditions". While this didn't cause any problems, it is a bug. The other two are the things that reset those rate limits and magnitude limits each time so they can be selectively enforced. |
||
| } | ||
|
|
||
| /** | ||
| * Resets the controller conditions on the feedback minimization task, the feedback gains, and the dynamic relaxation minimization task. | ||
| * Also sets that the controller is not to attempt to regularize the feedback minimization task. | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -448,7 +448,7 @@ public void compute(double currentTime, | |
| { | ||
| tempPoint2D.set(footstepSolution.getPosition()); | ||
| computeBestReachabilityConstraintToUseWhenNotIntersecting(); | ||
| FrameConvexPolygon2DReadOnly reachability = getSelectedRegion(); | ||
| FrameConvexPolygon2DReadOnly reachability = getSelectedReachableRegion(); | ||
| if (!reachability.isPointInside(tempPoint2D)) | ||
| reachability.orthogonalProjection(tempPoint2D); | ||
| footstepSolution.getPosition().set(tempPoint2D); | ||
|
|
@@ -559,12 +559,12 @@ private void projectAdjustedStepIntoCaptureRegion(FramePoint3DReadOnly pointToPr | |
| { | ||
| captureRegionInWorld.orthogonalProjection(adjustedSolution); | ||
| computeBestReachabilityConstraintToUseWhenNotIntersecting(); | ||
| getSelectedRegion().orthogonalProjection(adjustedSolution); | ||
| getSelectedReachableRegion().orthogonalProjection(adjustedSolution); | ||
| } | ||
| else | ||
| { | ||
| computeBestReachabilityConstraintToUseWhenIntersecting(); | ||
| getSelectedRegion().orthogonalProjection(adjustedSolution); | ||
|
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I switched this back to what it was previously before the previous change. As written in the code, if returning the selected region, it returned the intersection between the reachable region and the capture point. Previously, the conditions would return this if the intersections were valid, so that there was an intersection, and if there were no intersections, it would return just the reachable region. The change in the PR returned only the selected one, so that the projection failed. I changed this, so that if there's an intersection, it returns the selected reachable region, while refactoring the previous method to say "selectedReachableCaptureRegion", which is what is returned if these regions are valid. |
||
| getSelectedReachableCaptureRegion().orthogonalProjection(adjustedSolution); | ||
| } | ||
|
|
||
| footstepAdjustment.set(adjustedSolution); | ||
|
|
@@ -706,7 +706,7 @@ private double getSelectedArea() | |
| }; | ||
| } | ||
|
|
||
| private FrameConvexPolygon2DReadOnly getSelectedRegion() | ||
| private FrameConvexPolygon2DReadOnly getSelectedReachableCaptureRegion() | ||
| { | ||
| return switch (selectedReachableRegion.getEnumValue()) | ||
| { | ||
|
|
@@ -716,6 +716,17 @@ private FrameConvexPolygon2DReadOnly getSelectedRegion() | |
| }; | ||
| } | ||
|
|
||
| private FrameConvexPolygon2DReadOnly getSelectedReachableRegion() | ||
| { | ||
| return switch (selectedReachableRegion.getEnumValue()) | ||
| { | ||
| case FORWARD -> reachabilityConstraintHandler.getForwardCrossOverPolygon(); | ||
| case BACKWARD -> reachabilityConstraintHandler.getBackwardCrossOverPolygon(); | ||
| case BASELINE -> reachabilityConstraintHandler.getReachabilityConstraint(); | ||
| }; | ||
| } | ||
|
|
||
|
|
||
| private boolean deadbandAndApplyStepAdjustment() | ||
| { | ||
| boolean adjusted; | ||
|
|
||
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.
I consolidated this logic into a single reset method, while also removing the limits.