From 2a5e0e8ae7a42a2dab891bdda203bfadce926893 Mon Sep 17 00:00:00 2001 From: spirkelmann Date: Thu, 27 Jun 2019 14:11:19 +0200 Subject: [PATCH] added condition if marker cannot be found --- remote_control/casadi_opt.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/remote_control/casadi_opt.py b/remote_control/casadi_opt.py index c20167b..bdf5f50 100644 --- a/remote_control/casadi_opt.py +++ b/remote_control/casadi_opt.py @@ -236,8 +236,9 @@ class OpenLoopSolver: for o in obstacles: p = obstacles[o].pos r = obstacles[o].radius - for k in range(1,self.N): - self.opti.subject_to((self.X[0,k]-p[0])**2 + (self.X[1,k]-p[1])**2 + self.slack > r**2) + if p is not None: + for k in range(1,self.N): + self.opti.subject_to((self.X[0,k]-p[0])**2 + (self.X[1,k]-p[1])**2 + self.slack > r**2) # pass posx = self.X[0, :] posy = self.X[1, :]