Simulating vehicles that doesn't collide with each other
조회 수: 3 (최근 30일)
이전 댓글 표시
Hey,
I’m trying to simulate Boid like vehicles.
Now I want that they “care” for each other and don’t crash in another.
Is there a good algorithm for that?
My Idea would be kind of this:
I’m calculating the euclidean distance between all Boids at every iteration and store the distance in a matrix.
After that I extract the indices of all matrix values smaller than ε, so now I know which two Boids are to close.
Now I want that they change velocities so it’s like an inelastic kick. And hopefully this is enough to “kick” them out of the ε radius.
But I think this is not a good way to do this, it will be very time consuming.
What do you think?
I’m a beginner at programming so it would be helpful if there is a “simple” solution.
Best,
Wenzel
댓글 수: 0
채택된 답변
Dheeraj Singh
2019년 12월 16일
One of basic approaches, as you have suggested, can be based on Euclidean distance between the two vehicles. This can be achieved using Vector Field Histogram block.
You can refer to the following example for more detail about implementation:
There are other algorithms specifically for multi agent collision avoidance such as: Velocity Obstacles, Reciprocal Velocity obstacles etc.
Also, if you just want to plan paths for multiple agents from start to goal locations there are different algorithms such as: Conflict based search, M* etc.
But they are quite complex to implement. For simple tasks the first approach should work fine.
댓글 수: 0
추가 답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Introduction to Installation and Licensing에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!