Skip to content

Commit

Permalink
Merge pull request #148 from krishauser/teamb_planning
Browse files Browse the repository at this point in the history
TeamB Planning: Trapezoidal profile and Yeilding to pedestrian
  • Loading branch information
brijesh2709 authored Feb 27, 2025
2 parents fe6e644 + 15b7dda commit 173405b
Show file tree
Hide file tree
Showing 6 changed files with 652 additions and 85 deletions.
16 changes: 0 additions & 16 deletions GEMstack/knowledge/routes/forward_15m.csv

This file was deleted.

41 changes: 32 additions & 9 deletions GEMstack/onboard/perception/agent_detection.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,29 +5,52 @@
import threading
import copy

import numpy as np

class OmniscientAgentDetector(Component):
"""Obtains agent detections from a simulator"""
def __init__(self,vehicle_interface : GEMInterface):

def __init__(self, vehicle_interface: GEMInterface):
self.vehicle_interface = vehicle_interface
self.agents = {}
self.lock = threading.Lock()

self.start_pose = None

def rate(self):
return 4.0

def state_inputs(self):
return []
return ['vehicle']

def state_outputs(self):
return ['agents']

def initialize(self):
self.vehicle_interface.subscribe_sensor('agent_detector',self.agent_callback, AgentState)
def agent_callback(self, name : str, agent : AgentState):
self.vehicle_interface.subscribe_sensor('agent_detector', self.agent_callback, AgentState)

def agent_callback(self, name: str, agent: AgentState):
with self.lock:
self.agents[name] = agent

def update(self) -> Dict[str,AgentState]:
def update(self, vehicle : VehicleState) -> Dict[str, AgentState]:
with self.lock:
return copy.deepcopy(self.agents)
res = {}
ped_num = 0

if self.start_pose is None:
self.start_pose = vehicle.pose
# print("\nVehicle start state self.start_pose:", self.start_pose)
# print("\nVehicle current state:", vehicle.pose, vehicle.v)

for n, a in self.agents.items():
# print("\nBefore to_frame: Agent:", n, a.pose, a.velocity)
a = a.to_frame(ObjectFrameEnum.START, current_pose = a.pose, start_pose_abs = self.start_pose)
# print("\nAfter to_frame START: Agent:", n, a.pose, a.velocity)
# print('==============', a.pose.frame==ObjectFrameEnum.START)
res[n] = a
if a.type == AgentEnum.PEDESTRIAN:
ped_num += 1
if ped_num > 0:
print("\nDetected", ped_num, "pedestrians")
return res
Loading

0 comments on commit 173405b

Please sign in to comment.