Skip to content

Commit a33fe36

Browse files
Add pedestrain tracking in mpl viz
1 parent a469876 commit a33fe36

4 files changed

Lines changed: 16 additions & 6 deletions

File tree

GEMstack/onboard/perception/pedestrian_detection.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -239,7 +239,7 @@ def viz_object_states(self, cv_image, boxes, extracted_pts_all):
239239

240240
def update_object_states(self, track_result: List[Results], extracted_pts_all: List[np.ndarray]) -> None:
241241
# self.prev_agents = self.current_agents.copy()
242-
self.current_agents.clear()
242+
# self.current_agents.clear()
243243

244244
# Return if no track results available
245245
if track_result[0].boxes.id == None:

GEMstack/onboard/visualization/mpl_visualization.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
import matplotlib.animation as animation
66
import time
77
from collections import deque
8+
from ...state.agent import AgentEnum
89

910
class MPLVisualization(Component):
1011
"""Runs a matplotlib visualization at 10Hz.
@@ -71,12 +72,20 @@ def debug_event(self, source, event):
7172
plot.popleft()
7273

7374
def update(self, state):
75+
# print("State type:", type(state))
7476
if not plt.fignum_exists(self.fig.number):
7577
#plot closed
7678
return
7779
self.num_updates += 1
7880
self.debug("vehicle","velocity",state.vehicle.v)
7981
self.debug("vehicle","front wheel angle",state.vehicle.front_wheel_angle)
82+
83+
# Add pedestrian tracking
84+
for agent_id, agent in state.agents.items():
85+
if agent.type == AgentEnum.PEDESTRIAN:
86+
self.debug(f"ped_{agent_id}", "x", agent.pose.x)
87+
self.debug(f"ped_{agent_id}", "y", agent.pose.y)
88+
8089
time_str = time.strftime("%Y-%m-%d %H:%M:%S", time.localtime(state.t))
8190
#frame=ObjectFrameEnum.CURRENT
8291
#state = state.to_frame(frame)

launch/fixed_route.yaml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,8 +72,7 @@ variants:
7272
perception:
7373
state_estimation : OmniscientStateEstimator
7474
agent_detection : OmniscientAgentDetector
75-
visualization: !include "klampt_visualization.yaml"
76-
#visualization: !include "mpl_visualization.yaml"
75+
visualization: [!include "klampt_visualization.yaml", !include "mpl_visualization.yaml"]
7776
log_ros:
7877
log:
7978
ros_topics : !include "../GEMstack/knowledge/defaults/standard_ros_topics.yaml"

launch/pedestrian_detection.yaml

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -57,9 +57,11 @@ variants:
5757
detector_only:
5858
run:
5959
description: "Run the pedestrian detection code"
60-
drive:
61-
planning:
62-
trajectory_tracking:
60+
drive:
61+
planning:
62+
trajectory_tracking:
63+
visualization: !include "mpl_visualization.yaml"
64+
6365
real_sim:
6466
run:
6567
description: "Run the pedestrian detection code with real detection and fake simulation"

0 commit comments

Comments
 (0)