RobotLocomotion / drake

Model-based design and verification for robotics.
https://drake.mit.edu
Other
3.24k stars 1.25k forks source link

Solving GcsTrajectoryOptimization with Minimum Duration Zero Leads to Cryptic Bug #21722

Closed cohnt closed 3 weeks ago

cohnt commented 1 month ago

What happened?

If the user sets the minimum duration in regions to zero, this occasionally causes strange bugs in the construction of a PiecewiseTrajectory, when success would be expected. Here's a simple reproduction:

from pydrake.all import Point, Hyperrectangle, GcsTrajectoryOptimization

gcs = GcsTrajectoryOptimization(1)
start = gcs.AddRegions([Point([0])], 0)
goal = gcs.AddRegions([Point([1])], 0)
mid = gcs.AddRegions([Hyperrectangle([0], [1])], 1, h_min=0)

gcs.AddEdges(start, mid)
gcs.AddEdges(mid, goal)

gcs.SolvePath(start, goal)

Running this yields the following output:

INFO:drake:Solved GCS shortest path using Mosek with convex_relaxation=true and preprocessing=true and rounding.
INFO:drake:Finished 1 rounding solutions with Mosek, discarding 99 duplicate paths.
Failure at common/trajectories/piecewise_trajectory.cc:19 in PiecewiseTrajectory(): condition 'breaks_[i] - breaks_[i - 1] >= kEpsilonTime' failed.

I'll try to diagnose this and fix it sometime in the next couple of days.

Version

No response

What operating system are you using?

No response

What installation option are you using?

No response

Relevant log output

No response

cohnt commented 1 month ago

Looks like the issue is GCS produces a trajectory whose start and end times are equal (since it can travel at "infinite velocity"). What is the desired behavior here?