Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

added violations recording for pedestrian collisions #143

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

zhengc84
Copy link
Collaborator

@zhengc84 zhengc84 commented Mar 4, 2025

added collision checking between vehicles and pedestrians. Fixes #140
The violations are recorded in violations.json.

Test with NCAP_723-sdv.osm (scenario developed for ford)

the desirable outcome should look something like this:
{"1": {"12": {"CollisionWithPedestrian": {"colliderId": 4, "message": "v1 bounding box overlapped with the pedestrian agent v4"}}}}

@zhengc84 zhengc84 requested a review from mantkiew March 4, 2025 19:41
@mantkiew mantkiew requested a review from drodeur March 4, 2025 19:47
Copy link
Collaborator

@mantkiew mantkiew left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Works, just small tweaks. @drodeur could you have a super quick look?

@mantkiew
Copy link
Collaborator

mantkiew commented Mar 4, 2025

Let's harmonize with NCAP: https://cdn.euroncap.com/media/58226/euro-ncap-aeb-vru-test-protocol-v303.pdf
See page 13. The dimensions of an adult are
width: 0.5 m
length: 0.6 m

So we can approximate that with a radius of 0.27 m. I updated the constant.

@@ -159,6 +175,19 @@ def do_polygons_intersect(self, polygon_a, polygon_b):
return False;

return True

def check_circle_rectangle_collision(self, centre, rectangle, radius):
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this checking is not that great. The pedestrian could be close to the closest point but still outside of the bounding box. We need to see that it's actually inside the box. Additionally, the pedestrian could "slip through" the middle between two vertices: the width is 1.8 m, so there's a gap of 1.26 m in between! Even worse for the length, which is 4.5 m.

Copy link
Collaborator

@mantkiew mantkiew left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

image
Consider the situation in the image. A very crude and fast check would be to see if
minx<=px<=maxx and miny<py<maxy that would place it inside the dashed box. Of course, that condition would be true for pedestrian P, which would be a false positive. So, we need to now confirm that it actually intersects with the bounding box.

image
In this image, we can use the orange circle (vx, vy) with radius (vw/2). If the pedestrain is inside, collision for sure. Using the larger blue circle can have pedestrian P as a false positive.

So, all these are just very simple and fast checks. I would do the following:

  1. check whether within the orange circle first, if not,
  2. check whether within the dashed box, if yes
  3. do a detailed check with the proper bounding box overlap.

@mantkiew
Copy link
Collaborator

mantkiew commented Mar 4, 2025

Another super quick approximation of the bbox check I've seen would be with two circles:
image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

CollisionWithPedestrian
2 participants