WebServerThe WebServer module allows you to view images being processed by RoboRealm over the web using a regular web browser. The webserver within RoboRealm is off by default and needs to be turned on before becoming active. To activate the RoboRealm WebServer select the checkbox in the options dialog as seen below. You can view this interface by clicking on the "Options" button in the main RoboRealm dialog.
Activating the WebServer RoboRealm will transmit images over a TCP/IP network using port 8080. To connect to these images (after activating the webserver) point your browser at http://localhost:8080/ or use your machine name in place of localhost if you are accessing the images remotely.
Images are transmitted using an MJPEG encoding to a Java applet running within your web browser. Alternatively, if you are using FireFox or other MJPEG compliant browser (this does NOT include IE) you can access the image stream directly using http://localhost:8080/mjpeg.cgi This allows you to connect the video stream to other streaming systems that are typically used with Internet WebCams that stream their video also using an MJPEG format.
The webserver is configured to only return a few types of files. Most of those files are located in the RoboRealm/webroot directory that you unzipped RoboRealm into. The following are the files returned and their usage:
- index.html - contains the HTML for the Java applet and is returned on initial contact to the webserver. The page is very simple and only contains the needed Java applet code to configure the browser to contact RoboRealm and start streaming video.
- favicon.ico - the favicon is the icon used when bookmarking or indicating the link type in many web browsers.
- RoboRealm.class - the actual Java applet class returned to the web browser to start streaming.
- mjpeg.cgi - this is a virtual filename that does not exist on the file system but instead signals to the webserver to start streaming.
You can specify different variables to be communicated back to the RoboRealm Webserver based on HTML buttons/checkboxes/etc. If you look at the HTML code for the buttons you will see the onclick specified as
To then react to this variable (for example in driving a robot) you will need to hook that variable into whatever module you are using (typically seen as a variable dropdown). For example, suppose you are using one of the Servo modules (like the SSC) to control a servo. The variable you used in that module's variable dropdown is called "move_servo" and ranges from 0 to 255. You would then ensure that this variable is in the SSC module under the variable dropdown (either select it if already existing or type it in). Then edit your HTML page and add a new HTML button with an onclick attribute in it like:
<input type="button" value="GO" onclick="setVariable('move_servo=255')">which would set the servo to 255 if that button is pressed. You can add more buttons to stop it, something like
<input type="button" value="STOP" onclick="setVariable('move_servo=128')">would set the servo back to neutral 128. Using this technique of communicating back values to RoboRealm and interfacing them with various modules can provide a easy way to web enable the control of many devices.
Note that the RoboRealm WebServer is NOT intended as a replacement for industry standard webservers such as Apache or IIS and therefore does not have any additional functionality other than basic video streaming.
For security reasons, RoboRealm does NOT allow access to other folders other than the RoboRealm folder. If you wish to put images into a /images folder you will need to do so using another WebServer with the appropriate reference. Adding images to the RoboRealm installation folder (typically c:\program files\RoboRealm) WILL be accessible to the browser and served by the webserver.
|WebServer Related Forum Posts||Last post||Posts||Views|