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!