Simulating vehicles that doesn't collide with each other

2 views (last 30 days)
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

Accepted Answer

Dheeraj Singh
Dheeraj Singh on 16 Dec 2019
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.

More Answers (0)

Categories

Find more on Simulink in Help Center and File Exchange

Products


Release

R2019a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!