News update: Oculus can now be purchased via RobotShop.com in most counties.
As a follow up to the blog on using good old telnet to control oculus, I’ll give a few examples of how you can test your own scripts.
A standard telnet session from my OSX machine follows, note the password can be plain text or the “hashed” or “salted” string you’ll find in the config/settings.txt file.
Last login: Mon May 14 21:25:43 on ttys001 macbook:~ brad$ telnet 192.168.1.45 4444 Trying 192.168.1.45... Connected to 192.168.1.45. Escape character is '^]'. oculus version 552 ready for login. brad:xxxxxxxxxxxxxxxxxx override : true 1 tcp connections active state [0] echo: state floodlight : false firmware : oculusDC override : true spotlightsetbrightness : 0 localaddress : 192.168.xx.xxx boottime : 1337025399058 lightport : COM8 serialport : COM4 externaladdress : 24.85.247.196
Here I’ve only entered one command after logging in. “State” simply dumps the current shared variables back to standard output. Each command will be accounted for each session and you will always get an immediate echo. So, you’ll see a rolling and unique reply in the square braces, easy to parse out. All this echo tells you is that the command was received and dispatched. Any output from the command manager will be sent back in an asynchronous manner, so you can enter commands as fast as you like and the replies can come back in any order. An example is the “dockgrab” command, it can take up to 45 seconds to give up searching for the dock. In that time, several other commands can be serviced. You can rely on the state object to do atomic operations on any values stored in it! Threading on the oculus platform is mandatory because there is so much user interface, web and streaming video going on that no one operation should hold up tomcat or the web application.
So, you can do things like this to store your own, thread safe, storage on the robot itself.
[7] echo: red state red true [8] echo: state red true red : true state [9] echo: state floodlight : false firmware : oculusDC override : true red : true spotlightsetbrightness : 0
Once you are logged in, you can always ask for the command lift with the “help” command. If you just want to get into the bot quickly to test or monitor a certain field, simply use the SWING app built in. This will log you in using the admin user’s credentials in the settings file. See the runtime configurations in eclipse below:
The time saver is that you can up and down arrow through the valid command set from the input field. Again, I would say this is a very useful de-bugging and scripting tool, but you wouldn’t want to use this GUI to control the robot yourself.. but is ideal to control the robot from another programming language or to automate your testing.
In the above screen shot, note that the IP addresses are different and only one login was successful. If you are developing on the laptop that oculus is running on, then you don’t need to enter a user name and password. This is ideal because then you are not duplicating your password in the development environment. If your bot and development are on separate machines, then you must give the credentials. So, please use your salted strings, not plain text, if you are keeping these passwords in eclipse. Doing a factory reset will kill the salt value in settings.txt and then all the passwords will be invalidated.
Here is a one line script to restart the bot, note that you can add a list of commands after the password.. but they must be commands that don’t take any arguments. See the developer page in the code site’s wiki.
# reboot oculus java -classpath $CLASSPATH developer.terminal.Terminal $HOST $PORT $USER $PASSWD restart bye
Now, from your preferred scripting language, just open a socket in the same manor and start sending messages back and forth. If there is interest, I’ll write a wrapper in C/C++ or Ruby etc.

