Skip to content

Feature/improve collision avoidance #721

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

Merged
merged 4 commits into from
Mar 18, 2025

Conversation

rjgriffin42
Copy link
Member

No description provided.

@@ -390,27 +422,27 @@ private void optimizeKnotPoints(PlanarRegionsList planarRegionsList, HeightMapDa
collisionLocationsViz.get(j).setToNaN();
collisionGradientsViz.get(j).setToNaN();
}
continue;
Copy link
Member Author

Choose a reason for hiding this comment

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

This continue call actually jumped out of the outer loop, which was wrong.

{
double scale = swingKnotPoints.get(j).computeMaximumDisplacementScale(collisionGradients.get(j));
collisionGradients.get(j).scale(scale);
Copy link
Member Author

@rjgriffin42 rjgriffin42 Mar 14, 2025

Choose a reason for hiding this comment

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

Moved to inside the other if block to make the continue block not needed.

@@ -77,7 +81,7 @@ public class CollisionFreeSwingCalculator
private final List<FramePoint3D> defaultWaypoints = new ArrayList<>();
private final List<FramePoint3D> modifiedWaypoints = new ArrayList<>();

private final SwingKnotOptimizationResult swingKnotOptimizationResult = new SwingKnotOptimizationResult();
private final SwingKnotOptimizationResult swingKnotOptimizationResult = new SwingKnotOptimizationResult(numberOfKnotPoints);
Copy link
Member Author

@rjgriffin42 rjgriffin42 Mar 14, 2025

Choose a reason for hiding this comment

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

uses this static variable fixes a size difference.

@@ -555,10 +556,9 @@ private void checkForCollisions(FootstepPlannerRequest request, PlanarRegionsLis

List<Point3D> waypoints = footstepPlan.getFootstep(0).getCustomWaypointPositions();
RecyclingArrayList<FramePoint3D> waypointListCopy = new RecyclingArrayList<>(FramePoint3D.class);
if (waypoints.size() > 0)
for (Point3D waypoint : waypoints)
Copy link
Member Author

@rjgriffin42 rjgriffin42 Mar 14, 2025

Choose a reason for hiding this comment

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

This was a wild bug that caused a bunch of false negatives

@@ -650,22 +650,22 @@ public double getExtraSizeHigh(Axis3D axis)
collisionRelativeToEndFoot.changeFrame(endFootPoseFrame);
collisionRelativeToStartFoot.changeFrame(startFootPoseFrame);

double distanceToCollision = collisionBox.distance(collision);
double distanceToCollision = collisionBox.signedDistance(collision);
Copy link
Member Author

Choose a reason for hiding this comment

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

This was also a wild bug that prevented getting the distance correctly.

if (collisionResult.getSignedDistance() < closestDistance)
{
closestDistance = collisionResult.getSignedDistance();
closestCollision = new Point3D(collisionResult.getPointOnB());
}

boolean colliding = (closestDistance + 1.5e-2) < 0.0;
boolean colliding = (closestDistance + 1e-3) <= 0.0;
Copy link
Member Author

Choose a reason for hiding this comment

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

That was way too big an epsilon

@@ -692,6 +692,8 @@ public SwingPlannerParametersBasics getParameters()
SwingPlannerParametersBasics parameters = new DefaultSwingPlannerParameters();
// parameters.setDoInitialFastApproximation(true);
parameters.setMinimumSwingFootClearance(0.05);
parameters.setMaxDisplacementLow(0.5);
parameters.setMaxDisplacementHigh(0.5);
Copy link
Member Author

Choose a reason for hiding this comment

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

This was needed to allow enough expansion

@@ -503,7 +503,7 @@ private void checkForCollisions(FootstepPlannerRequest request, PlanarRegionsLis
hittingEndGoal |= endFootPolygon.getMinX() < desiredPosition.getX();
hittingStartGoal |= desiredPosition.getX() < startFootPolygon.getMaxX();

double distanceToCollision = foot.distance(collision);
double distanceToCollision = foot.signedDistance(collision);
Copy link
Member Author

Choose a reason for hiding this comment

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

Also a wild bug

@rjgriffin42 rjgriffin42 merged commit 666bf1e into develop Mar 18, 2025
61 of 68 checks passed
@rjgriffin42 rjgriffin42 deleted the feature/improve_collision_avoidance branch March 18, 2025 19:31
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.

2 participants