Skip to content

The Field

Charles Hong edited this page Jun 19, 2021 · 9 revisions

The field in the Pimulator is a square with dimensions 144 by 144 inches. In the web app, you will see that the UI displays the coordinates of the center of the robot, according to the coordinate system in the diagram above.

The convention used in the Pimulator is that all the simulation code for robots, objects, and sensors, as well as anything displayed to the user, uses inches (so coordinates for each dimension range from 0 to 144). You can assume that all code in the worker thread (such as robot.js) uses inches.

When we finally receive position values in base.js and display them using HTML Canvas, we convert inches to pixels using the variable scaleFactor, which is currently 3. This means the 144 by 144 inch field is displayed in a 432 by 432 pixel Canvas. base.js is the only place where pixels, rather than inches, are used as units for the field.

Clone this wiki locally