Skip to content
Robot simulator using web technologies, just JavaScript
JavaScript CSS HTML
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Type Name Latest commit message Commit time
Failed to load latest commit information.

WebSim2D Simulator


  • First install NodeJS, open a terminal and type the next commands:
    1. Ubuntu / Linux distributions
     sudo apt-get update &
     sudo apt-get install nodejs &
     sudo apt-get install npm
2. Windows: Go to the [next]( link and click on ***Windows installer***.


  • Ubuntu: In a terminal change directory to WebSim2D/websim2d and execute:
    nodejs server.js
  • Windows: In CMD console change directory to WebSim2D/websim2d and execute:
    node server.js

Open your web browser and write this URL; localhost:8000/, for base WebSim2D version and localhost:8000/teleoperator, for the teleoperator version.


The robot can be teleoperated using the arrows to the right of WebSim2D. The following video shows the teleoperator running:


To set the velocity values:

  • myRobot.setV(v). v is the value of the linear velocity

  • myRobot.setW(w). w is the value of the angular velocity.

To get the current velocity values:

  • v = myRobot.getV()

  • w = myRobot.getW()

To clear the velocity values:

  • myRobot.clearVelocity()

To Infrared Sensor:

  • ir = myRobot.getInfrared()*

*The function returns three arrays of RGB data. The first corresponds to the front IR sensor, the second to the left sensor and the third to the right (ir.Front, ir.Left, ir.Right)

To Ray-Cast Sensor:

  • ray = myRobot.getRayCast()*

*The function returns an array with all rays. Each ray contains the information of the x and y coordinates, and the range to which each ray reaches where each ray ends (ray[n].x, ray[n].y or ray[n].range)

You can’t perform that action at this time.