Skip to content

Commit 385f2de

Browse files
committed
quadrotor_obstacles : use the plotting util
1 parent 5fbbf64 commit 385f2de

File tree

1 file changed

+12
-6
lines changed

1 file changed

+12
-6
lines changed

examples/quadrotor_obstacles.py

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -324,6 +324,10 @@ def setup() -> aligator.TrajOptProblem:
324324
tol = 1e-4
325325
if args.bounds:
326326
mu_init = 1e1
327+
if args.obstacles:
328+
mu_init = 1.0
329+
# elif args.obstacles:
330+
# mu_init = 1e-2
327331
else:
328332
mu_init = 1e-6
329333
verbose = aligator.VerboseLevel.VERBOSE
@@ -371,6 +375,8 @@ def plot_costate_value() -> plt.Figure:
371375

372376
root_pt_opt = np.stack(xs_opt)[:, :3]
373377
if args.plot:
378+
from aligator.utils import plotting
379+
374380
if len(results.lams) > 0:
375381
plot_costate_value()
376382

@@ -388,13 +394,13 @@ def plot_costate_value() -> plt.Figure:
388394
plt.legend(["$x$", "$y$", "$z$"])
389395
ax1.scatter([times_wp[-1]] * 3, x_term[:3], marker=".", c=["C0", "C1", "C2"])
390396
ax2: plt.Axes = fig.add_subplot(1, nplot, 3)
391-
n_iter = np.arange(len(history_cb.prim_infeas.tolist()))
392-
ax2.semilogy(
393-
n_iter[1:], history_cb.prim_infeas.tolist()[1:], label="Primal err."
397+
plotting.plot_convergence(
398+
history_cb,
399+
ax2,
400+
res=results,
401+
show_al_iters=True,
402+
legend_kwargs=dict(fontsize=8),
394403
)
395-
ax2.semilogy(n_iter, history_cb.dual_infeas.tolist(), label="Dual err.")
396-
ax2.set_xlabel("Iterations")
397-
ax2.legend()
398404

399405
fig.tight_layout()
400406
for ext in ["png", "pdf"]:

0 commit comments

Comments
 (0)