File tree Expand file tree Collapse file tree
GEMstack/onboard/perception Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ # assigns pedestrians the same id
2+ # calculates velocity
3+
4+ class AgentTracker ():
5+ """Associates and tracks AgentState agents.
6+ """
7+ def __init__ (self ):
8+ self .__lost_agents = [] # Stores LostAgent objects that are no longer detected
9+ self .prev_agents = [] # dict{id: agent} is more efficient, but list for
10+ self .current_agents = [] # simplicity to match update() output to start
11+ self .drop_agent_t : float = 1.0 # The maximum length of time a lost agent is stored before it is dropped in seconds
12+
13+ def assign_ids (self , agents : list ) -> Dict [str ,AgentState ]:
14+ """
15+ """
16+ agents = {}
17+
18+ def __convert_to_start_frame (self ):
19+ """Converts a list of AgentState agents from ouster Lidar frame of
20+ reference (which is in reference to the current frame) to start
21+ frame frame of reference
22+ """
23+ pass
24+
25+ def __agents_overlap (ped1 , ped2 ) -> bool :
26+ """Determines if two AgentState objects overlap.
27+
28+ returns true if they overlap, false if not
29+ """
30+ pass
31+
32+ def __calculate_velocity (self ):
33+ """
34+ """
35+ pass
Original file line number Diff line number Diff line change 1+ class IdTracker ():
2+ """Abstracts out id tracking
3+ """
4+ def __init__ (self ):
5+ self .__ped_id = 0
6+
7+ def get_new_ped_id () -> int :
8+ """Returns a unique pedestrian id
9+ """
10+ assigned_id = self .__id
11+ self .__ped_id += 1 # id will intentionally overflow to get back to 0
12+ return assigned_id
Original file line number Diff line number Diff line change 1+ # something to store current id
2+ # that current id will intentionally overflow to increment back down to 0
3+
4+ # GEM imports:
5+ from ...state import AgentState
6+
7+ class LostAgent ():
8+ def __init__ (self , last_id : int , last_state : AgentState ):
9+ self .time_since_seen : float = 0.0 # Time since the agent was last seen in seconds
10+ self .last_id : int = last_id
11+ self .last_state : AgentState = last_state
12+
13+ def update_time (time : float ):
14+ """Updates the time since the agent was last seen
15+ """
16+ if time <= 0 :
17+ # TODO: log error here
18+ print ("UPDATE TIME FOR LOST AGENT WAS LESS THAN OR EQUAL TO 0" )
19+ else :
20+ self .time_since_seen += time
You can’t perform that action at this time.
0 commit comments