Walter O. Krawec

 

Simple Robot Simulator 2010 (SRS10)

Download SRS10 (Source and Windows Binaries): (ZIP) 706KB.

Simple Robot Simulator 2010 (SRS10) is a basic robot simulator which I've used extensively in my own AI experiments. Written in C++ and using OpenGL it runs over a network connection allowing multiple clients (which may be on separate computers) to connect and control multiple robots. The Simulator was tested on Windows (with some work it should work on other platforms); the client code was tested on Windows and Mac OS.

One may include a simple interface into your C++ program to access SRS10's functionality (via commands such as "addRobot(string& name)" or "getSensor(string& robotName, string& sensorName)"). Alternatively, one may write programs in wok::Interpreter using a Lisp/Scheme style syntax. For example, the following simple program creates a robot with two IR sensors that avoids walls:

begin
	(NOP Create a new robot called "robot1")
	(srs10::add_robot robot1)

	(NOP Add two IR sensors (range .75 rotation +-40 degrees from center)
		call the sensors "left" and "right")

	(srs10::add_sensor robot1 IR left 0.75 40.0)
	(srs10::add_sensor robot1 IR right 0.75 -40.0)

	(NOP Repeat until the user presses a key)
	(while (not (user.input kbhit))
		(srs10::poll_sensors robot1)

		(NOP use srs10::get_sensor to get the value of a sensor (by name)
			returns 0 or 1; use srs10::move_command to issue a simple
			movement command 1=forward, 3=left, etc.)
		(cond
			(srs10::get_sensor robot1 left)
				(srs10::move_command robot1 4)
			(srs10::get_sensor robot1 right)
				(srs10::move_command robot1 3)
			(1)
				(srs10::move_command robot1 1)
		)
	)

	(srs10::disconnect 0)