Skip to content

Commit 81e0534

Browse files
soft clearing
1 parent 066499e commit 81e0534

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

src/object_spatial_tools_ros/robot_kf_undirected_object_tracker.py

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ def __init__(self, x_start, t_start, Q_diag, R_diag, k_decay, color, score):
3030
self.x = np.array([x_start[0], x_start[1], 0.0, 0.0])
3131
self.last_t = t_start
3232
self.last_upd_t = t_start
33-
self.last_soft_update = None
33+
self.last_soft_update = t_start
3434
self.Q = np.diag(Q_diag)
3535
self.R = np.diag(R_diag)
3636
self.k_decay = k_decay
@@ -81,10 +81,10 @@ def predict(self, t):
8181
def update(self, z, t, score, soft = False):
8282
self.last_upd_t = t
8383

84-
if soft:
84+
if not soft:
8585
self.last_soft_update = t
86-
else:
87-
self.last_soft_update = None
86+
#else:
87+
#self.last_soft_update = None
8888

8989
y = z - np.matmul(self.H, self.x)
9090

@@ -129,7 +129,7 @@ def __init__(self):
129129
self.Rdiag = rospy.get_param('~Rdiag', [0.1, 0.1])
130130
self.k_decay = rospy.get_param('~k_decay', 1)
131131
self.lifetime = rospy.get_param('~lifetime', 0)
132-
self.lifetime = rospy.get_param('~lifetime_soft', 0)
132+
self.lifetime_soft = rospy.get_param('~lifetime_soft', 0)
133133
self.mahalanobis_max = rospy.get_param('~mahalanobis_max', 1)
134134

135135
self.approve_thrash = rospy.get_param('~approve_thrash', 1)
@@ -167,7 +167,9 @@ def process(self, event):
167167
for i, kf in enumerate(kfs):
168168

169169
regular_cond = self.lifetime == 0 or (now - kf.last_upd_t) < self.lifetime
170-
soft_cond = (kf.last_soft_update is None) or (now - kf.last_soft_update) < self.lifetime_soft
170+
soft_cond = (now - kf.last_soft_update) < self.lifetime_soft
171+
172+
#rospy.logerr(f"soft cond {soft_cond} time {now} {kf.last_soft_update}")
171173

172174
if regular_cond and soft_cond:
173175
kf.predict(now)

0 commit comments

Comments
 (0)