## Networking

The main function of CRISS is to emulate the vision and wireless robot systems. It receives AI data from any external AI’s connected to the system, and sends field data to the respective AI units. The networking portion of CRISS is responsible for establishing communications between the simulator and such AI clients. CRISS is equipped to use the 2002 Cornell RoboCup networking protocols, as established by the Networking subgroup.

The networking module establishes a send and receive server from the given IP and port number entered at the command line. If an invalid or no IP and port number were entered, the simulator will be initialized on the local host 127.0.0.1 and port 4545.

### Framerate:

After the server is established, the networking module enters a loop that passes any AI data it receives to the physics engine, runs the physics engine for one cycle, and sends out vision Packet to the respective AI clients. In order to facilitate this process, the networking module converts AI data and field data into structs used by the physics engine. One pass through this process is known as a frame.

The frame rate is defined to be the number of frames of data per second that the simulator passes and receives from the AI. The frame rate at which the simulator will run can be set under the required attribute frame_rate in the tag <simworld> of the XML parameters file. The simulator automatically adjusts the sleep time between each frame to maintain the desired frame rate.

### Latency:

A latency component is implemented in the networking module. This emulates the latency that is inherent in the actual vision, wireless and networking systems. In our implementation, the number of frames of latency is specified in the XML parameters file, under the attributes in_latency and out_latency in the tag <simworld>.

The in_latency refers to the number of frames of delay from the time when AI data is sent by the AI to the time when these commands are executed by the robots. In other words, the physics engine will receive the AI data after the number of frames specified by in_latency.

The out_latency mimics the latency from vision processing in returning current field data to the AI. Out_latency specifies the number of frames that the field data is delayed before being sent to the AI.

The default latency is set to 0 – the current field data is returned to the AI without delay, and the current AI data is sent to the physics engine without delay. This feature allows for the testing of AI prediction algorithms and similar code.

### Vision Noise:

The real vision system has some noise within it. We use a simple model to model this noise in the simulator. A random number is generated between 0 and 1 (radius_noise) as well as between 0 and 2*PI (angle_noise). This is used to get the translational_noise by adding the real x with radius_noise * cos(angle_noise) and real y with radius_noise *sin(angle_noise). The rotational noise is uniformly distributed between –5 and +5 degrees. This is not an exact model of the noise but it is good enough to give the AI or arbiter the sensation of noise.