GT-RAIL / rms

RMS (Robot Management System)
http://wiki.ros.org/rms
Other
28 stars 24 forks source link

Tutorial The Generate Function #22

Closed alicef closed 10 years ago

alicef commented 10 years ago

I completed this tutorial with no issues: http://wiki.ros.org/rms/Tutorials/AGuideToInterfaceDevelopment

The link at the bottom The next tutorial The Generate Function, is broken http://wiki.ros.org/rms/Tutorials/TheGenerateFunction

I opened this page instead: http://wiki.ros.org/rms/Tutorials/TheGenerateFunction_ But I cannot get the code to execute properly.

The code does not have a "class" in it (which I know is required from the Interface Development tutorial. So I assume the code should be pasted below the code in the existing index.php file.

My code is as follows: <?php class my_first_interface{ function generate($robot_environment) { // create a reference to the current use $user = $robot_environment->get_user_account();

// lets begin by checking if we have the correct widgets if(!$robot_environment->get_widgets_by_name('MJPEG Stream')) { create_error_page('No MJPEG streams found.', $user); } else if(!$robot_environment->get_widgets_by_name('Keyboard Teleop')) { create_error_page('No Keyboard Teloperation settings found.', $user); } else if(!$robot_environment->authorized()) { create_error_page('Invalid experiment for the current user.', $user); } else { // let's create a reference to the environment ID $envid = $robot_environment->get_envid(); // also, grab the array of KeyboardTeleop widgets $teleops = $robot_environment->get_widgets_by_name('Keyboard Teleop'); // here we can spit out the HTML for our interface ?> <!DOCTYPE html>

create_head()?> My First Interface ``` make_ros() // connect to ROS ?>

Welcome, !



  <?php
  }
}
?>

This is the error I get when I try to open the interface:
Parse error: syntax error, unexpected '<', expecting T_FUNCTION in /home/obot/rms/build/api/robot_environments/interfaces/my_first_interface/index.php on line 6 
rctoris commented 10 years ago

The tutorial on the generate function was for a much older version of RMS and was therefore removed. You happened to stumble upon the archived version of the tutorial.

The idea of the generate function is the same, but a lot of the PHP functions have been removed in favor of using more standard JavaScript techniques. As such, I will say this:

The most important thing the generate function tutorial teaches you is that that function must spit out all HTML for the interface. With the new version of RMS, you can use all of the tools provided by Robot Web Tools (http://robotwebtools.org/). I would take a glance at that tutorial and look through the code for the basic interface (https://github.com/WPI-RAIL/rms/blob/stable/build/api/robot_environments/interfaces/basic/index.php). This should give you an idea of what's going on.

alicef commented 10 years ago

This is great. Thanks for redirecting me. I added a note to the top of the old tutorial identifying it as an "OBSOLETE TUTORIAL". I hope this is appropriate. The link I followed is #14 here: wiki.ros.org/rms/Tutorials/

-Alice

On Tue, Nov 19, 2013 at 3:50 PM, Russell Toris notifications@github.comwrote:

The tutorial on the generate function was for a much older version of RMS and was therefore removed. You happened to stumble upon the archived version of the tutorial.

The idea of the generate function is the same, but a lot of the PHP functions have been removed in favor of using more standard JavaScript techniques. As such, I will say this:

The most important thing the generate function tutorial teaches you is that that function must spit out all HTML for the interface. With the new version of RMS, you can use all of the tools provided by Robot Web Tools ( http://robotwebtools.org/). I would take a glance at that tutorial and look through the code for the basic interface ( https://github.com/WPI-RAIL/rms/blob/stable/build/api/robot_environments/interfaces/basic/index.php). This should give you an idea of what's going on.

— Reply to this email directly or view it on GitHubhttps://github.com/WPI-RAIL/rms/issues/22#issuecomment-28833747 .

rctoris commented 10 years ago

Closing with release of 2.0.0.