The simulator main entities are the Robots. The simulator goal is to create these robots - which are simulated clients, make them advance on different directions and speeds, and report them the server. The simulator lets you decide how many robots you want to create and how often to report to the server (parameters can be found and changed in “Consts.java” file on the simulator code). With the simulator running at the background, when running the client we could see the robots on movement and get a better image of how the application would work under real life conditions.
How do the Robots work?
Robots are created on the simulator and make movement according to a set of rules defined on the simulator:
- Initial state: after getting roads from the server, each robot randomizes a road and an initial position on the road to start its movement from.
- Each robot randomizes its path on the road, and moves according to it, while keeping his movement only on the road.
- Each road segment has its “demo speed” which is the target speed that has been randomized by the server for a specific scenario. The Robots current speed is a function of the demo speeds + Gaussian randomized offset (which is used to describe a typical car movement on the road).
- When a robot gets to the end of its road, it disappears and a new robot instead is created in a different location.
- The simulator sends to the server information about each robot (location, speed, name…) and the server treats him as he was a real user and updates the information on his side.