loading
 
RR Webserver. How to use the commands/buttons?
Mano from Netherlands  [27 posts]
13 year
I have read the documentation of the webserver. But there only seems to be info about the video stream.

I would like to know how to make use of the buttons. I want to make my robot drive by pushing the buttons on the webserver page. I allready have my setup working with avm navigator, so if i could use the same variables....

Anonymous 13 year
Mano,

If you look at the HTML code for the buttons you will see

onclick="setVariable('move=1')"

specified in each of the buttons. What that does is call a Javascript routine called setVariable (also in the HTML page above) which will call the RR webserver and tell it to create a variable called 'move' and set the value to 1. In this way any button can be created to set a variable to a specific value back in RoboRealm. To drive the robot you will need to hook a variable into whatever module you are using to drive your robot and specify that same variable in this SetVariable routine in the HTML button. For example, supose you are using one of the Servo modules (like the SSC) to control a servo. The variable you used in that module is called "servo_value" and ranges from 0 to 255. You would then ensure that this variable is in the SSC module under the variable dropdown. Then edit you 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')">

and would set the servo to 255 if that button is pressed. Then you can add more buttons to stop it like

<input type="button" value="GO" onclick="setVariable('move_servo=128')">

etc.

Does that help?

STeven.
Mano from Netherlands  [27 posts] 13 year
Ah thank you! It's clear now.

Maybe a good idea to add this to the Documentation?
Mano from Netherlands  [27 posts] 13 year
One more question... Does the web controll overwrite the running .robo program?
Anonymous 13 year
We'll add that to the docs.

No, the web control just interacts with the RR webserver and does NOT overwrite the running .robo program. You can, however, set it up to overwrite it using the Load_Program module and a specific variable that would be sent by the webserver. Or you could just surround different tasks with the If Statement module and set that variable using a web button. Either way should work to create different views based on some mode button in the web interface.

I think our slideshow robofile on

http://www.roborealm.com/help/Getting%20Started.php

is an extreme example on how to switch to different views using a variable controlled by a VBScript module ... which could be removed and replaced with one coming from the web.

STeven.

This forum thread has been closed due to inactivity (more than 4 months) or number of replies (more than 50 messages). Please start a New Post and enter a new forum thread with the appropriate title.

 New Post   Forum Index