Rovio WebServer (URLs, JavaScript and tech stuff)

60 posts / 0 new
Last post
RobosapienPet
RobosapienPet's picture
Rovio WebServer (URLs, JavaScript and tech stuff)

Rovio acts like a web server. Your computer's browser connects to that web server and the Rovio provides web pages for the user interface (with changing content, like the current camera image)

 The default main webpage provides the full screen user interface using JavaScript "http://{IP_ADDRESS}/index.htm"
(replace {IP_ADDRESS} with your Rovio's IP address, eg: 10.x.y.z or 192.168.x.y typically)

For mobile devices, iPhone/iPod/WinCE, it automatically redirects to "http://{IP_ADDRESS}/mobile/index.htm"
This is a stripped down version for smaller screens

The webpage is selfcontained on the web server (Rovio), including all images
(eg: "http://{IP_ADDRESS}/img/titlebar/titlebar_left.gif")

NOTE: The current camera image can be accessed directly by:
http://{IP_ADDRESS}/Jpeg/CamImg.jpg
----

The rovio.js JavaScript explains how much of the glue works
http://{IP_ADDRESS}/lib/rovio.js (edit with any text editor)

It uses something called "Prototype and Scriptaculous", a combination of useful JavaScript libraries
http://www.stevekallestad.com/blog/prototype_and_scriptaculous_compressed.html
("combined prototype and scriptaculous" version)

Most of the functionality is performed in .CGI scripts (see rovio.js), some with URL args (eg: "&blah=1") or http request POSTed args.

Camera features:
"http://{IP_ADDRESS}/Cmd.cgi + POSTED_ARGS" is the main one, which can call other .CGI functions
Functionality is VERY similar to this camera:
http://www.canvision.net/product/product_pt300_eng.html
http://www.canvision.net/support/pt300-cgi/CmdList.htm (some don't apply)
There are others, "GetData.cgi" for getting camera data, "Change???.cgi" for changing settings (resolution, frame rate, volume, etc), "Reboot.cgi" to reboot, "GetWlan.cgi" for settings, ... (there are others, look at the "index.htm" source as well as "rovio.js")

Robot features (movement etc)
"http://{IP_ADDRESS}/rev.cgi + POSTED_ARGS" is for robot control. See "rovio.js"

I could go into more detail, but it is relatively easy to figure out by examining the two HTML files (regular and mobile) and the "rovio.js" file.

-----
More advanced hackability:
The web server on the Rovio does not support browsing folders, or provide 'ftp'. This means there is no (easy) way to browse the entire file system.
There is a firmware update feature. Since there hasn't been a firmware update, the format used and the possibilities of hacking it are TBD.

Bottom line, it looks like they joined their robot control to an existing web cam (not unlike the way RS Media was put together)

Rudolph
Rudolph's picture

Coolness, man. I see meetrovio.com is up now too, as is myrovio.com (though the latter seems to show the same site).

Nocturnal
Nocturnal's picture

Ahhh.... I don't know what firmware version your Rovio has, but there is a firmware update available off the support site.

http://www.wowweesupport.com/product_item.php?cat=tech_tab&item=rovio

RobosapienPet
RobosapienPet's picture

> I don't know what firmware version your Rovio has, but there is a firmware update available off the support site.
Thanks.
My Rovio came with an earlier version.
BTW: you have direct access to the firmware (and apparently the entire flash memory including settings) using the USB connection. Also the firmware looks like a simple (flat, unencrypted) format, easy to disassemble.
I'll put info in another thread (whether it is worth the effort to 'hack' it or not is a different question...)

don
don's picture

When configuring for remote control, is it necessary to connect the rovio directly to a router for initial configuration to the router? or does rovio find the wireless network without a hardwire connection?

Rudolph
Rudolph's picture

It connects to your PC via USB for initial setup, if you use Windows. It is possible to set up a wireless ad-hoc connection as well, for "advanced" or Mac users.

RobosapienPet
RobosapienPet's picture

There are many "CGI" scripts. You run them by accessing a specific URL on the Rovio web server (usually through JavaScript). Simple args can be stuck on the end of the URL (separate with ? and &). More elaborate args use the HTTP "POST" method (usually through JavaScript).

For example:
"http://{IP_ADDRESS}/EnableTestNet.cgi?port=100"
Where "{IP_ADDRESS}" is the IP address of the Rovio (eg: 10.0.1.99 or 192.168.0.33)

Most of them return an HTML page that reports success or failure or some statistical info. This makes them extremely easy to play with. In a program setting you'll need to parse the return HTML (usually through JavaScript, see rovio.js and helper library)
Some return binary data like "GetData.cgi"

Here's a list of all the implemented .CGI scripts.

Camera/video/microphone control:
    ChangeBrightness.cgi (note 1,2)
    ChangeCompressRatio.cgi (note 1,2)
    ChangeResolution.cgi (note 1,2)

    GetMotionDetect.cgi - return Enable and Sensitivity
    SetMotionDetect.cgi (note 1,2)

    GetCamera.cgi - return frequency = 60 ??
    SetCamera.cgi ??

    GetMediaFormat.cgi - return Audio and Video format types
    SetMediaFormat.cgi ??

    ChangeSpeakerVolume.cgi (note 3)
    ChangeDirection.cgi ??
    ChangeFramerate.cgi (note 3)
    ChangeMicVolume.cgi (note 3)

Data streaming:
    GetData.cgi - returns streaming data, format unknown (ignore note 2)
    GetAudio.cgi ??

Network setup:
    GetHttp.cgi (note 1,2)
    SetHttp.cgi (note 1,2)
    GetIP.cgi (note 1,2)
    SetIP.cgi (note 1,2)
    GetMail.cgi (note 1,2)
    SetMail.cgi (note 1,2)
    GetName.cgi (note 1,2)
    SetName.cgi (note 1,2)

Status:
    GetVer.cgi (note 1,2)
    GetTime.cgi (note 1,2)
    SetTime.cgi (note 1,2)
    GetLog.cgi (note 1,2)
    GetStatus.cgi (note 2)

    GetDDNS.cgi - DDNS settings (note 3)
    SetDDNS.cgi
    GetLogo.cgi ??
    SetLogo.cgi
    GetMac.cgi - MAC address (note 3)
    SetMac.cgi
    GetWlan.cgi - WiFi settings (note 3)
    SetWlan.cgi
    SendMail.cgi - send the mail (note 3)

User management:
    GetUser.cgi (note 1,2)
    SetUser.cgi (note 1,2)
    DelUser.cgi (note 1,2)
    SetUserCheck.cgi (note 1,2)
    GetMyself.cgi (note 1,2)

Firmware update and other system special:
    Reboot.cgi (note 1,2)
    SetFactoryDefault.cgi (note 2)
    Upload.cgi - update firmware (note 3)
    UpdateFactoryDefault.cgi ??
    GetUpdateProgress.cgi - part of update firmware

Status/Debug special:
    Cmd.cgi - sends multiple commands in one request (note 1,2)
    rev.cgi - appears to be same as "Cmd.cgi" (note 3)

    debug.cgi - has some weird debug features (see below)
    EnableTestNet.cgi - debug/test feature (see below)
    mcu (no .cgi) - motor robot control (note 3)

To figure out how many of these are used, examine the "rovio.js" or these two webpages of similar WebCams (not all tested, so args may differ)
(note 1) http://www.relecs.com/doc/ipcamcmd.txt
(note 2) http://www.canvision.net/support/pt300-cgi/CmdList.htm
(note 3) can't find documentation, but something is used in "rovio.js"
Others marked "??" are unknown, but should be easy to figure out with a some experimentation.
------
"mcu" (no .cgi) appears to be the glue for lower level robot commands. It requires a long string of numbers in a "parameters" arg. I think it is sent directly to the serial port to control the robot motion.
This needs more exploration (used often in rovio.js)
-----

Here's a list of stupid URL tricks. Many you won't find in the regular HTML or rovio.js:

"http://{IP_ADDRESS}/EnableTestNet.cgi?port=100"
    Open a telnet-like port on the Rovio that you can connect to.
    It sends out test data. NOTE: port number must be over 100

"http://{IP_ADDRESS}/debug.cgi?action=XXXXX"
    Where XXXXX is:
        checkip, ddns, line, uart, mcu, break, cfg, gpiob19, mall
    there are others (write_mp4, read_mem, write_mem)

    "uart" appears to dump a capture of data -- from where?.
    "mall" appears to dump memory status
    Play with them and see if you can figure out any uses for them.

"http://{IP_ADDRESS}/debug.cgi?action=read_mem&address=0x10000000&size=0x100"
    Read memory (you can use it to dump
    There is a similar "write_mem" (which you shouldn't use either ;-)

"http://{IP_ADDRESS}/Cmd.cgi?Cmd=nav&action=1"
    Summary text report for robot status (normally formatted by main webpage)

"http://{IP_ADDRESS}/Jpeg/CamImg.jpg
    Image capture, most current image.


[sorry for the formatting, someone needs to wiki-fy this or create a regular webpage for this kind of info]

dnorwood2
dnorwood2's picture

The Rovio has the ability to store locations and return to them with a simple "goto" command. You don't have to give it directions. Has anyone figured out how to access this feature via a CGI call? Also, how to tell it to return to it's charging station?

David

RobosapienPet
RobosapienPet's picture

> The Rovio has the ability to store locations and return to them with a simple "goto" command.... Has anyone figured out how to access this feature via a CGI call?

This is the "path" feature. I believe the data is stored in the motion control unit. Check out "rovio.js" for details.

All the higher level robot features are sent with
"http://{IP_ADDRESS}/rev.cgi?Cmd=nav&action=XXXXX"
(or "Cmd.cgi". "mcu?" is used for lower level control)

XXXXX=1 : get status
XXXXX=2 : start recording path
XXXXX=3 : abort recording path (resume roaming)
XXXXX=4 : save path (extra "&name=YYYYY" arg)
XXXXX=5 : delete one path (extra "&name=YYYYY" arg)
XXXXX=6 : refresh/get path list
XXXXX=7 : goto path (extra "&name=YYYYY" arg) - ie. play/perform recorded path
XXXXX=10 : pause recording path
XXXXX=11 : rename path (extra "&name=YYYYY&newname=ZZZZZ" args)
XXXXX=13 : goto home position (ie. charging station)
XXXXX=14 : save home position
XXXXX=17 : stop (full stop)
XXXXX=18 : robot movement (extra "&drive=YYYYY" arg) -- see below
XXXXX=19 : turn on headlight (extra "&LIGHT=0" or "&LIGHT=1" arg)
XXXXX=19 : turn on IR (extra "&IR=0" or "&IR=1"  arg)
XXXXX=21 : delete all paths
XXXXX=24 : get parameter (extra "&index=YYYYY" arg) or get all (no extra arg)
XXXXX=25 : get version number
XXXXX=33 : stop moving
    (other numbers not yet explored)

OR:
"http://{IP_ADDRESS}/rev.cgi?Cmd=nav&action=18&drive=YYYYY"
YYYYY=11 : move camera up full
YYYYY=12 : move camera down
YYYYY=13 : move camera half way

OR:
"http://{IP_ADDRESS}/rev.cgi?Cmd=nav&action=18&drive=YYYYY&speed=ZZZZZ"
YYYYY=1 to 10 => move robot in specific direction
(requires extra 'mcu' commands, see rovio.js)

dnorwood2
dnorwood2's picture

Thanks for the quick reply. I can't wait to play with these commands.

Dave C
Dave C's picture

Thanks for all the leg work, I'm still waiting on mine from H&S, but this exactly what I was going to dig into to....

So it looks like :
"http://{IP_ADDRESS}/rev.cgi?Cmd=nav&action=7&name=INSERTNAME"

will Navigate to a saved location?
Pretty simple :)

I plan to connect it to my home automation and security system so when a motion sensor is triggered and it's armed have him wander over to that location and take some pics :) Of course I'm going to need some remote beacons, anyone have news on those?

Dave

Tom B
Tom B's picture

What a great bunch of info, thanks RoboSapienpet!

I don't have my rovio yet, so let me ask...has anybody figured out the arguments to return the current position of the Rovio in the room (I would assume it is in an X,Y position + rotation, or something like that)?

Thanks!

dj_siek
dj_siek's picture

Dave C said: Thanks for all the leg work, I'm still waiting on mine from H&S, but this exactly what I was going to dig into to.... So it looks like : "http://{IP_ADDRESS}/rev.cgi?Cmd=nav&action=7&name=INSERTNAME" will Navigate to a saved location? Pretty simple :) I plan to connect it to my home automation and security system so when a motion sensor is triggered and it's armed have him wander over to that location and take some pics :) Of course I'm going to need some remote beacons, anyone have news on those? Dave

Dave that is the coolest thing.

Rudolph
Rudolph's picture

@Tom B

Snippet from above;

All the higher level robot features are sent with
"http://{IP_ADDRESS}/rev.cgi?Cmd=nav&action=XXXXX"
(or "Cmd.cgi". "mcu?" is used for lower level control)

XXXXX=1 : get status

 

Status returns a wad of information, including what appears to be relative x,y position to the nearest beacon. Unfortunately I don't know what units the numbers are in...

Nocturnal
Nocturnal's picture

Not sure which is the best to use, but

http://{ip_address}/rev.cgi?Cmd=nav&action=1

returns a bunch of values, which includes a current x and y position.

Tom B
Tom B's picture

Rudolph and Nocturnal,

Supercool, thanks.

I can alraeady think of some great hacks. Depending on the maximum refresh rate (how many positions I can get back per second) this could create some very interesting graphics and/or video effects.

T.

Nocturnal
Nocturnal's picture

It seems to update fairly often, that is I get a different x/y position each time I hit refresh (several times a second), even though Rovio is sitting on the base, so there is a certain amount of error with regards to positional accuracy.

Tom B
Tom B's picture

Nocturnal said: It seems to update fairly often, that is I get a different x/y position each time I hit refresh (several times a second), even though Rovio is sitting on the base, so there is a certain amount of error with regards to positional accuracy.

I was considering writing a little VB program to send position queries at a high rate; then log those that come back with a time stamp, and thus figure what the max feasible update rate.  Ideally I'd like to get 10 per second. 

 But, I foolishly neglected to order in advance, so I don't have one to play with yet!  Arrgh.

Nocturnal
Nocturnal's picture

Looks like Wow Wee has released the web api, its on the support website under manuals.

http://www.wowweesupport.com/product_item.php?cat=tech_tab&item=rovio

roschler
roschler's picture

Nocturnal,

Do you see an call to get Rovio's microphone audio? I just see a call GetAudio that sends audio to Rovio from the client.

RobosapienPet
RobosapienPet's picture

> Do you see an call to get Rovio's microphone audio?
There is no simple call AFAIK. It is mixed with the MPEG video.
The GetData.cgi operation allows you to poll the MPEG data (which I assume includes the audio - I haven't tested that variant)

Much better is to setup an "RTSP" connection. Part of the "SETUP" process lets you pick which tracks/streams you need. The normal control under IE sets up track0 (video) and track1 (audio) interleaved.
If you are only interested in audio, you can SETUP only track1 (audio) and Rovio will stream the 8kHz-8bit data. I have it partially working for HomieGate. Will post more when it is running.

RobosapienPet
RobosapienPet's picture

Here's a version of my simple test program for direct connecting to Rovio using RTSP and streaming 2-way audio.
http://aibohack.com/rovio/test1.zip

Please read the README.TXT
It is very simple and direct, and a little slimy in places. Does what is necessary and not much more. I added a few comments.
It needs more work and testing for reliability and error tolerance if you want to use it in a more serious application. Windows specific but it can be easily ported to other platforms.

Free to use, but if you do use it I ask only one thing in return (especially those with connections at WowWee).
Please add your protest to this thread and hopefully WowWee will live up to their legal obligations which will make the Rovio a much more hackable robot.
http://www.robocommunity.com/forum/thread/14178/Rovio-uses-eCos-WowWee-o...

mrmiata
mrmiata's picture

Has anyone actually found out how to send these commands with javascript? I can do it with a simple HTML link, but none of my javascript/ASP "posts" seems to work, which I use on my website to request data from the webserver (AJAX style), so I'm not sure how to proceed from here.

milw
milw's picture

I think the JavaScript security restricts it from accessing URLs that are not in the domain where the JS itself resides- that means you can't get it to work unless you get your JS loaded onto Rovio itself AFAIK. I played with this some, if you look in the java console you should see the errors. I switched to PHP, so my own webserver running the PHP script will access the URLs, process the data and return it to my browser.

milw
milw's picture

I stickied this thread to keep it in view; also forgot the exact form of URL to send user:pword in- should it be 'http://user:pword@{rovio ip address}'?

mrmiata
mrmiata's picture

I think you're right about the JS, milw. I didn't think about that, but I've encountered that problem before actually.

However, some kind of HttpXMLrequests *should* be able to use, don't you think? That even works across domains, to get feeds etc. It might be because I didn't use the user:pword@IP format. I just logged in at the Rovio first, but of course if I'm executing the ASP code from the server, it's probably the servers IP address that needs to be authorized - and not mine.

Will give it another go when I get time :)

RobosapienPet
RobosapienPet's picture

> I think the JavaScript security restricts it from accessing URLs that are not in the domain where the JS itself resides
That is the default for most (/all) browsers. That's a good thing.

For experimenting in your own trusted local web, you can turn it off.
Check your browser's options.
Under IE: Internet Options / Security Settings, add to Trusted Sites, and adjust custom level to "Access data sources across domains"
(be careful you only do it for trusted sites, otherwise you will open up your webbrowser to vulnerabilities)

milw
milw's picture

I've removed IE as it is too much of a security risk to begin with. Also I'm trying to do the PHP dev on Mac, so I'm using Firefox mainly, sometimes Safari. I don't think FF allows you to bypass the security restriction?

RobosapienPet
RobosapienPet's picture

>> For experimenting in your own trusted local web, you can turn (cross-domain blocking) off.
> I don't think FF allows you to bypass the security restriction?
I think older version may have allowed it. The general technique is viewed as a bad thing, and shut down as a fix to prevent exploits.
In the future,  a new internet standard may re-enable it in a legit way (http://www.w3.org/TR/access-control/ ) and we'll wait another 100 years for the browsers to implement it.

But for experimenting, in a controlled environment, IE (with security off) hopefully should be adequate.
Once the JavaScript is tested and perfected, it can be downloaded into the Rovio web server itself, and general users can access the webpages without any cross-domain problems.

milw
milw's picture

RobosapienPet said: ..Once the JavaScript is tested and perfected, it can be downloaded into the Rovio web server itself, and general users can access the webpages without any cross-domain problems.

 Do you think WowWee will eventually give us access to upload JS files into Rovio? Or perhaps it could be embedded in a firmware image. Another thought, perhaps it could be implemented in Flash... hm.

Svengalie
Svengalie's picture

Thanks for that, cudos for putting this together.

Pages