rparak / Collision_Detection

An open-source library for collision detection of the bounding boxes (AABB, OBB) useful for robotics applications.
MIT License
13 stars 3 forks source link

Insights about how to use the existing approach with moving AABB and robot path #1

Open Rak-r opened 5 months ago

Rak-r commented 5 months ago

Firstly thank you for the great and intuitive work for collision detection. I am developing an application where I need to find the collision point between the moving robot and detected/tracked pedestrian. To check the collision I have a path which robot is following as series of waypoints which I am using to get small line segments along the full path and for pedestrian I have boxes.

I have gone through the Collider -> core.py where the raycast function I checks the intersection between line segment and AABB. Everything is implemented in ROS2, so I already have real world data and transformed in whatever frame I work with. I have robot and pedestrian velocities as well.

I am getting a bit confused about how to find collision point when both robot and pedestrian are in motion assuming pedestrian is moving just straight ( that's why I can use AABB for pedestrian).

Is it something like after finding the intersection from the raycast method, then find the time robot will take to reach that intersection and same for pedestrian, then compare if 2 times are similar or there something else can be done?

@rparak

rparak commented 4 months ago

Hi @Rak-r,

I'm really sorry for the late reply, but I was on vacation.

I have not implemented a method that determines the exact collision point between two bounding boxes. For your problem, you need to modify the "Overlap" function because the output is currently only "True/False." If the problem focuses on two AABB objects, it will be easy: just see if the objects overlap and use the min/max values to figure out where.

I'm currently very busy, but it's on my to-do list. Thank you for your feedback.

If you just use the "Raycast" function, where the segments will be obtained from the robot's trajectory, it won't be accurate, but it's a good starting point.

If you have any problems with editing my code, feel free to contact me.

Have a great weekend.

Best regards, Roman P.