Commit 386e730b authored by Leigh Stoller's avatar Leigh Stoller

Checkpoint latest and greatest robot tracker applet that includes

ability to move multiple robots around. Still needs testing, but
want to get this off my laptop just in case windows decides to do
something stupid ...
parent f98b15a7
This diff is collapsed.
......@@ -50,7 +50,8 @@ if (isset($fake)) {
$i = 0;
do {
echo "garcia1, robbie, $x1, $y1, $z1, 90.0, 700, 300, -90.0, 10, 20\n";
echo "garcia2, mary, $x2, $y2, $z2, 0.0, 200, 100, 90.0, 50, 60\n";
echo "garcia2, mary, $x2, $y2, $z2, 0.0, , , , 50, 60\n";
echo "garcia3, robin, 300, 300, 0.2, 0.0, , , , 90, 95\n";
flush();
sleep(1);
......@@ -64,10 +65,16 @@ if (isset($fake)) {
}
$last_stamp = 0;
$loop_count = 0;
# Loop forever.
while (1) {
if ($last_stamp)
if ($loop_count == 30) {
# The point is to update everything every 30 seconds.
$stamp_clause = "";
$loop_count = 0;
}
elseif ($last_stamp)
$stamp_clause = " and stamp>$last_stamp ";
else
$stamp_clause = "";
......@@ -121,6 +128,7 @@ while (1) {
echo "$pname, $vname, $x, $y, $z, $or, $dx, $dy, $dor, $bper, $bvolts\n";
}
$loop_count++;
flush();
sleep(1);
}
......
......@@ -49,13 +49,16 @@ echo "<table cellspacing=5 cellpadding=5 border=0 class=\"stealth\">
</table>
</td>
<td class=stealth>This applet allows you to view the robots
as they move around. The table at the bottom
as they move around, as well as move the robots
with drag and drop. The table at the bottom
shows the current position (x, y, orientation),
the destination position,
and the battery level (percentage and voltage).
The shaded areas (blue border) are <em>exclusion</em>
zones where robots are not allowed to go. You can
<b>click</b> on a robot to bring up its info page.
<b>right click</b> on a robot to bring up its
info page. See below for instructions on how to
use the <b>drag and drop</b> features.
</td>
</tr>
</table><hr>\n";
......@@ -104,5 +107,19 @@ echo "<applet code='RoboTrack.class'
<param name='ppm' value='$ppm'>
</applet>\n";
<br>
<center>
<h3>Using the Robot Tracker Applet</h3>
<ul>
<li> Right Click over a robot or mote will pop up a browser window showing
information about the robot/mote.
<li> Left click and drag over a (stationary) robot allows you to setup a
move to a new position. Remember to edit the orientation in the table,
if needed. Cancel by moving back to its original position.
<li> Left click over the background image brings up a menu to submit your
moves (start the robots on their way), or cancel the moves.
<li> Only one move per robot at a time.
</ul>
PAGEFOOTER();
?>
<?php
#
# EMULAB-COPYRIGHT
# Copyright (c) 2005 University of Utah and the Flux Group.
# All rights reserved.
#
chdir("..");
include("defs.php3");
#
# When called from the applet, the variable "fromapplet" will be set.
# In that case, spit back simple text based errors that can go into
# a dialog box.
#
if (isset($fromapplet)) {
$session_interactive = 0;
$session_errorhandler = 'handle_error';
}
else {
PAGEHEADER("Set Robot Destination");
}
#
# Capture script errors in non-interactive case.
#
function handle_error($message, $death)
{
header("Content-Type: text/plain");
echo "$message";
if ($death)
exit(1);
}
#
# Only known and logged in users can do this.
#
$uid = GETLOGIN();
LOGGEDINORDIE($uid);
#
# Check to make sure a valid nodeid.
#
if (isset($node_id) && strcmp($node_id, "")) {
if (!TBvalid_node_id($node_id)) {
USERERROR("Illegal characters in node ID.", 1);
}
if (!isset($x) || !isset($y) || !isset($o)) {
USERERROR("Must specify x,y,o coordinates!", 1);
}
# Create one entry array for code below.
$nodeidlist = array();
$nodeidlist[$node_id] = "$x, $y, $o";
}
elseif (!isset($nodeidlist)) {
#
# We expect an array of node ids otherwise.
#
USERERROR("Must specify a nodeid or a nodeidlist!", 1);
}
#TBERROR(print_r($nodeidlist, TRUE) . "\n\n", 0);
#
# Go through the list and check the args. Bail if any are bad.
#
while (list ($node_id, $value) = each ($nodeidlist)) {
if (!TBvalid_node_id($node_id)) {
USERERROR("Illegal characters in node ID.", 1);
}
if (! TBValidNodeName($node_id)) {
USERERROR("$node_id is not a valid node name!", 1);
}
if (! TBNodeAccessCheck($uid, $node_id, $TB_NODEACCESS_MODIFYINFO)) {
USERERROR("You do not have permission to move $node_id!", 1);
}
#
# Split up the argument into x,y,o and check them.
#
unset($matches);
if (!preg_match("/^(.*),(.*),(.*)$/", $value, $matches)) {
USERERROR("Must specify x,y,o coordinates for $node_id!", 1);
}
$x = $matches[0];
$y = $matches[1];
$o = $matches[2];
if (! (TBvalid_float($x) && TBvalid_float($y) && TBvalid_float($o))) {
USERERROR("Must specify proper x,y,o coordinates for $node_id!", 1);
}
}
#
# Okay, now do it for real ...
#
reset($nodeidlist);
while (list ($node_id, $value) = each ($nodeidlist)) {
#
# Split up the argument into x,y,o
#
unset($matches);
if (!preg_match("/^(.*),(.*),(.*)$/", $value, $matches)) {
USERERROR("Must specify x,y,o coordinates for $node_id!", 1);
}
$x = $matches[0];
$y = $matches[1];
$o = $matches[2];
$retval = SUEXEC($uid, "nobody",
"websetdest -x $x -y $y -o $o $node_id",
SUEXEC_ACTION_IGNORE);
#
# Report fatal errors.
#
if ($retval) {
USERERROR($suexec_output, 1);
}
}
#
# Standard testbed footer
#
if (!isset($fromapplet)) {
PAGEFOOTER();
}
?>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment