I'm starting to add autonomy to the robots that have been the main subject of this blog and one of the major considerations of permitting autonomy is how to coordinate and modify the behavior of mobile robots. One solution is to use web services, which are very commonly used to expose server based applications to either server or browser based consumers. The main uses I've been considering are task assignment and progress reporting, offloading processing from the weak onboard computer to a more powerful server, and to create a method for customizing the robots without exposing all of the source code.
For a demo, I wrote a web app that permits inputing numbers that represent direction of the robot and the duration of motion and stored it in a database. The robot then sends a request to a web service which gets the next entry from the database, returns it in XML format to the robot, and then deletes the entry from the database. The web service is a very simple REST style web service. It turned out to be very easy to do and took very little code. The following video demonstrate the web UI, the web service, and the robot calling the web service.
The PHP and SQL for the very simple web service is here. The following code just creates a client, which is an XML parser that uses code like...
...to get the response from the server then parses it. The interesting thing is that the polling that is in the following code can be replaced by a call to the embedded web server running on the iPod (part of EyesBot Driver) and that can initialize the request for the next task. In that case, each robot would check in when it comes online, basically giving its contact information (IP and port) to the web service, which would permit deploying new robots without requiring additional configuration.
These sort of instructions could clearly be applied to warehouse robots being assigned objects to retrieve, cleaning robots waiting for tasks to perform or security robots being told where potential intruders are. Additionally, moving logic and processing to servers makes it possible to take advantage of servers ability to horizontally scale and distribute workload, as well as coordinate work.
Effecting the physical world