I wanted to learn a little about Swarm robotics, and I was using Unity at the time for work, so I decided to simulate some little swarm robots with Unity and have them attempt to dodge collisions using “IR” communication.
Unity | C#
What did I Learn?
I mostly learned more about Unity MonoBehaviours and how to have virtual objects interact. I did learn a little about swarm robotics along the way, but I ended up mostly playing around with the Unity side of things.
How does it Work?
There are a number of “robot” agents in the scene. Each agent has 4 IR transceivers and when it detects the presence of another agent, it will attempt to back up to dodge it. All robots are attempting to get as close to a “goal” object as possible. Once a robot hits the goal, it broadcasts on all its IR transceivers that it’s managed it. Any robots in range then change their head colour to match the winner, and broadcast the same message.
I used the Unity RigidBody behaviours to create the four-wheel robots, and managed the physics parameters through the use of scriptable objects. Scriptable objects were also used to create event listeners, which are used to dynamically register and deregister nearby robots from each other.