Simulating vehicles that doesn't collide with each other

3 visualizaciones (últimos 30 días)
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

Respuesta aceptada

Dheeraj Singh
Dheeraj Singh el 16 de Dic. de 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.

Más respuestas (0)

Categorías

Más información sobre Simulink en Help Center y File Exchange.

Productos


Versión

R2019a

Community Treasure Hunt

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

Start Hunting!

Translated by