Controlling your iRobot Roomba using AJAX

Ajax and Roomba Wi-fi RemoteLike seen in previous articles about Roomba Wi-fi Remote usage and how to read JSON and XML files:

Sensos status can be read by JSON and XML with a refresh frequency of 500ms.

Knowing the API AJAX libraries that you use to work and your working environment, we can read asynchronously the robot sensors through an AJAXRequest to the URLs that contain the information in JSON or XML format (roomba.json and roomba.xml).

One can ask: could I control the robot through this method? The answer is: yes, you can. Roomba Wi-fi Remote has and accessible URL able to transmit using GET method the different robot buttons as parameters and it returns an answer in plain text depending on the operation result. See below a deeper explanation, hope it is useful!

Emulation buttons URLs

In the IDLE state (without any connection to the Roomba Wi-fi Remote’s Socket Server) you can emulate a push button action using a specific URL using GET parameters to specify the button that you want to emulate.

This skill is added to the last version: Roomba Wi-fi Remote v2 because some developers had requested for some Web Services or similar to make basic applications without sockets. With this URLs and the JSON or XML files you can make an easy App to manage your robot wothout TCP connections, although we recommend the use of sockets in the Gateway Mode to capture the data from robot’s sensors and control.

Let’s see the URL:

  • http:// Roomba_Wifi_Remote_IP /roomba.cgi

The parameter of GET is button and all its values could be:

  • CLEAN: Emultates the Clean Button.
  • SPOT: Emultates the Spot Button.
  • DOCK: Emultates the Dock Button.

The result is shown as plain-text and depends on the action is done or not. If the action is done the URL will print “1”, otherwise will print “0”. If the result is negative (0) may be caused by an existing TCP connection or an error occurred.

In order to explain it clearer the calls to URL would be:

  • http:// Roomba_Wifi_Remote_IP /roomba.cgi?button=CLEAN
  • http:// Roomba_Wifi_Remote_IP /roomba.cgi?button=SPOT
  • http:// Roomba_Wifi_Remote_IP/roomba.cgi?button=DOCK

If you have any question please send an email to info@roomba-wifi-remote.com and we will help you as soon as possible.

Tagged with: , , , , , , ,
Posted in Developers, RoombaWi-fi Remote v2