We have been experimenting with a different approach to SRV-1 interface with smart phones and browsers, building a very basic HTTPD capability into the SRV-1 firmware. It employs just HTML and javascript, using image mapping for the robot controls, so no special application has to be installed - only the built-in web browser. This is NOT robust (put your robot up on blocks, not on a table top, if you plan to test this), and performance will be lower that what will be achieved with native apps for iphone, android, etc, but it is simple and stability will likely improve.
Basically, there is now a minimal HTTPD function in the SRV-1 firmware that parses the HTTP GET command, and there is minimal knowledge of filenames, specifically '/', '/index.html', '/00.html' (same as /),'/01.html' ... '09.html'. These files correspond to flash sectors, where 00.html is stored in sectors 10-11, 01.html is stored in sectors 12-13, etc. An HTML file in this system can occupy up to 2 sectors (128kB), and a couple of console commands have been added to read ('zAxx') and write ('zBxx') these double sectors. The HTTPD parser recognizes two other special names - '/robot.cgi?' which is used to send robot commands for motion and laser on/off, and $$camera$$ which signals the insertion of a live captured JPEG frame. Perhaps the most important line of code in the following html is -
<img src="data:image/jpeg;base64,$$camera$$" width=320 height=240 usemap="#map1" />
which shows how the jpeg frame from the robot is embedded in the web page.
Assuming you have a new version of httpd.c and /index.html shown below is stored in sectors 10-11, you would point your browser to
http://robot-ip:10001/index.html and the robot should start to serve live frames (approx 3fps). If you click on different areas of the image, different robot commands should be executed.
Note that the latest code distribution has a www subdirectory. Upload www/index.html using XMODEM transfer, then use the new 'zBxx' command - zb10 - to write index.html from the flash buffer to flash sectors 10-11.
Code:<html>
<head>
<meta name="viewport" content="width=device-width; initial-scale=1.0; maximum-scale=1.0;">
<script language="JavaScript">
<!--
var time = null
function refresh() {
window.location.reload();
}
setTimeout('refresh()', 333)
//-->
</script>
<title>SRV-1 Robot</title>
</head>
<body>
<map name="map1">
<area href="/robot.cgi?l" alt="laser on" shape=rect coords="1, 1, 25, 120">
<area href="/robot.cgi?L" alt="laser off" shape=rect coords="296, 1, 320, 120">
<area href="/robot.cgi?+" alt="faster" shape=rect coords="1, 121, 25, 240">
<area href="/robot.cgi?-" alt="slower" shape=rect coords="296, 121, 320, 240">
<area href="/robot.cgi?4" alt="left" shape=rect coords="26, 1, 100, 80">
<area href="/robot.cgi?8" alt="forward" shape=rect coords="101, 1, 220, 80">
<area href="/robot.cgi?6" alt="right" shape=rect coords="221, 1, 295, 80">
<area href="/robot.cgi?0" alt="spin left" shape=rect coords="26, 81, 100, 160">
<area href="/robot.cgi?5" alt="stop" shape=rect coords="101, 81, 220, 160">
<area href="/robot.cgi?." alt="spin right" shape=rect coords="221, 81, 295, 160">
<area href="/robot.cgi?1" alt="back left" shape=rect coords="26, 161, 100, 240">
<area href="/robot.cgi?2" alt="back" shape=rect coords="101, 161, 220, 240">
<area href="/robot.cgi?3" alt="back right" shape=rect coords="221, 161, 295, 240">
</map>
<img src="data:image/jpeg;base64,$$camera$$" width=320 height=240 usemap="#map1" />
<br>
<a href="/index.html">reload</a>
<br>
</body>
</html>
This is approximately how the image map is configured based on the above HTML code -
Note that there are issues - the javascript seems to be very sensitive to timing so links break pretty easily and you have to refresh to get things restarted. Also, the G1 Android support for embedded JPEGs is broken, though we have reported the problem. The frame rate is low, and I don't know how much it can be improved, though error trapping will also help in this regard. In any case, this DOES work on an iPhone, and it can only get better.
This code has been posted to -
http://code.google.com/p/surveyor-srv1-firmware/ Download version is here -
http://code.google.com/p/surveyor-srv1-firmware/downloads/list