Welcome, Guest. Please Login.
Surveyor Corporation Surveyor SRV-1
Home Help Search Login

Surveyor Robotics Forum

Welcome to the user support forum for Surveyor SRV-1 robots, SRV-1 robot controllers and SVS stereo vision systems. To register for this forum, please send an email to support@surveyor.com which includes your desired forum user name, your registration email address, and a brief explanation of why you wish to join, and we will create a forum account for you.

Please note that there is a Search button in the forum toolbar for forum topics. Another effective search method for the entire surveyor.com site is to use Google, e.g. "xyz site://www.surveyor.com" where "xyz" is the search topic.



Pages: 1
Send Topic Print
srv-blackfin-091209 firmware - adds HTTP GET (Read 4733 times)
admin
YaBB Administrator
*****




Posts: 3676
srv-blackfin-091209 firmware - adds HTTP GET
09/08/09 at 10:30am
 
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
Back to top
 
« Last Edit: 10/08/09 at 8:53am by admin »  

SRV-1 Development Team
Surveyor Corporation
Email WWW   IP Logged
NickK1066
Senior Member
****




Posts: 299
Re: HTTPD experiment - web app approach to iphone,
Reply #1 - 09/08/09 at 2:21pm
 
Awesome.
 
Interestingly it should be possible to provide a GPS overlay on the image frames. Obviously it won't be google maps but it could provide waypoint positioning and compass directions without needing a client on the phone.
 
I was wondering: would be possible to have the served web page pull the images for both cameras?
Back to top
 
« Last Edit: 09/08/09 at 2:25pm by NickK1066 »  

  IP Logged
admin
YaBB Administrator
*****




Posts: 3676
Re: HTTPD experiment - web app approach to iphone,
Reply #2 - 09/08/09 at 3:44pm
 
The two feeds would be coming from two different IP addresses, so easiest approach is a 3rd web page that is pulling frames from the two different feeds.  The issue is that our HTTPD is not a full web server - all of the content has to be inline in a single page and it can't read other files, so there might be some complications in serving the combo page from one of the Blackfins, though maybe there is a way to set up frames.
 
We definitely could overlay graphic data such as heading and gps position in the JPEG itself.
Back to top
 
« Last Edit: 09/08/09 at 3:44pm by admin »  

SRV-1 Development Team
Surveyor Corporation
Email WWW   IP Logged
wheagy
Junior Member
**




Posts: 64
Re: srv-blackfin-091209 firmware - adds HTTP GET
Reply #3 - 09/19/09 at 11:40am
 
This is interesting.  Seems to work Ok for me, but i don't get any frame updates at all unless I hit reload. (On the iPhone).  Also, every time I reload a page, Safari gives me the error "Safari cannot open the page because the server cannot be found.".  I just hit Ok and it continues on.
 
Also tried it on a Nokia 770 internet tablet, but it didn't work.  I'm guessing the browser on that tablet (Opera based I think) is too old.
 
Win
Back to top
 
 
WWW wheagy wheagy   IP Logged
admin
YaBB Administrator
*****




Posts: 3676
Re: srv-blackfin-091209 firmware - adds HTTP GET
Reply #4 - 09/19/09 at 12:56pm
 
The camera feed seemed to update correctly on my son's iPhone.  I think there are some issues with processing clicks that are sent when the image is refreshing, and I plan to work on this.
 
There definitely are browser dependencies.  Inline imaage or "data URL's" are not supported by all browsers.
Back to top
 
« Last Edit: 09/19/09 at 12:58pm by admin »  

SRV-1 Development Team
Surveyor Corporation
Email WWW   IP Logged
Pages: 1
Send Topic Print