Skip to content

Commit

Permalink
Fix Python 3 issue and bug
Browse files Browse the repository at this point in the history
- RuntimeError: dictionary changed size during iteration

- `id()` doesn't exist
  • Loading branch information
LdwgWffnschmdt authored and v4hn committed Aug 19, 2024
1 parent 0b87d6e commit d0b284b
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions people_velocity_tracker/scripts/tracker.py
Original file line number Diff line number Diff line change
Expand Up @@ -123,9 +123,9 @@ def spin(self):
while not rospy.is_shutdown():
# Remove People Older Than timeout param
now = rospy.Time.now()
for p in self.people.values():
for p in list(self.people.values()):
if now - p.age() > self.TIMEOUT:
del self.people[p.id()]
del self.people[p.get_id()]
self.publish()
rate.sleep()

Expand All @@ -134,7 +134,7 @@ def publish(self):
pl = People()
pl.header.frame_id = None

for p in self.people.values():
for p in list(self.people.values()):
p.publish_markers(self.mpub)
frame, person = p.get_person()
pl.header.frame_id = frame
Expand Down

0 comments on commit d0b284b

Please sign in to comment.