Link Search Menu Expand Document

Getting started with JavaScript

Let’s code your first simulation robot in SoccerSim! First, open up the JavaScript editor. On the left, you have an editor, where you can program JavaScript code. On the right, you have the simulation.

JavaScript is pretty similar to C or Python - it just has a slightly different syntax. The following links may be helpful:


Your first SoccerSim program

The best way to start is to try get the robot moving! The following code will get your robot moving forward:

while (1) {
    setMotorSpeed('motorA', 50);
    setMotorSpeed('motorB', 50);
}

Then hit the green Run all button! You should see the robot move forward. You can click and drag on the robot to move it back. To rotate the robot, click and drag on the robot’s wheels.

To stop the robot, click the red ‘Stop all’ button.


For all robot commands, see the JavaScript reference guide.


Copyright © 2021 RoboCup Junior Australia