HybridRobotics / cbf

An open source repository for control, planning and navigation about control barrier functions.
Apache License 2.0
169 stars 26 forks source link

[helper]: DCBF constraints are hard constraints, why collisions still occur? #32

Closed Highlight123 closed 11 months ago

Highlight123 commented 11 months ago

cbf

Highlight123 commented 11 months ago

DCBF constraints are hard constraints. However, when maze_types = "maze" and robot_shapes = "pentagon", collisions still occur like this figure rather than getting stuck. What could be the reasons for this phenomenon, and how can we avoid it?

junzengx14 commented 11 months ago

@AkshayThiru Could you add some explanation for this? I'm OOO for vacation.

AkshayThiru commented 11 months ago

Hi @Highlight123, You are correct in that DCBFs are hard constraints on the optimization problem. However, when using an optimization problem for control, there are no guarantees that the problem is feasible. When the optimization is infeasible, it might be impossible to avoid the obstacles (this is true for DCBFs and distance constraints). This is the persistent feasibility problem in MPC. In our formulation, we use a braking controller to ensure persistent feasibility. There are still a few possible reasons for collisions:

  1. The horizon is not long enough: DCBFs require a shorter horizon length than distance constraints, but the horizon still might not be large enough.
  2. Discretization error: If the distance margin for safety is too small, the errors from discretizing time could prevent the DCBF optimization from being feasible. I suspect this is the issue here.

You could try increasing the MPC horizon, decreasing the time discretization interval (dt), and increasing the distance margin in the DCBF. Also, note that unless you have a backup controller for your dynamical system (like the braking controller in our case), you will have to tune the horizon length by hand. You can start with a large horizon length and reduce it till you can get safety empirically.

Highlight123 commented 11 months ago

Hi @AkshayThiru @junzengx14, I sincerely thank you for taking the time to respond to my issue during the holiday season. Your insights are invaluable!It has been profoundly meaningful to me. Wishing you a Merry Christmas and a joyous holiday season!