worldGenerator.py - TomHulme/306-Swarm-Robotics-Project GitHub Wiki
Overview
The world file generator takes several inputs and then generates a world file that can be used by stage based on these inputs. It determines where the fields go, and where the robots are placed in the world. The input that the world generator requires is a string describing the world file's name, the number of sheep you want to spawn per field, the number of fields, and the size of the field you wish to create.
Field Generation
To keep the simulation simple, it was decided that when more that one field is generated, they are placed in the world in a linear fashion. With the next field being on the right of the previous one. This also lead to implementation of how the truck would collect the sheep that need to be sold.
Fence Generation
This is described in greater detail here.
The world generator uses a simple algorithm to place the robots. It generates fields using an algorithm that places fences in a set position based on the number of fields and the size of the fields. It then fills these fields with the grass robots as well as the sheep robots.
Grass Generation
As decided by the group, the grass is placed inside the fields in a grid-like fashion. The grass robots are placed beneath the sheep. This was done to ensure that the sheep did not collide with the grass in any way.
Sheep Generation
The number of sheep value determines how many sheep are spawned in each field. The file places them in the field in a similar fashion to how the grass robots are placed.