Commit 67ff3af6 authored by Leigh Stoller's avatar Leigh Stoller

Add loc_z to the location info table, and display that on both the

static robot map and in the robot tracker applet.
parent 48d5c24a
......@@ -179,6 +179,7 @@ public class RoboTrack extends JApplet {
*/
static class Robot {
int x, y; // Current x,y coords in pixels
double z; // Current z in meters
double or = 500.0; // Current orientation
int dx, dy; // Destination x,y coords in pixels
double dor = 500.0; // Destination orientation
......@@ -192,6 +193,7 @@ public class RoboTrack extends JApplet {
String battery_percentage = "";
String x_meters = "";
String y_meters = "";
String z_meters = "";
String or_string = "";
String dx_meters = "";
String dy_meters = "";
......@@ -287,6 +289,16 @@ public class RoboTrack extends JApplet {
robbie.x_meters = FORMATTER.format(robbie.x / pixels_per_meter);
robbie.y_meters = FORMATTER.format(robbie.y / pixels_per_meter);
str = tokens.nextToken().trim();
if (str.length() > 0) {
robbie.z = Double.parseDouble(str);
robbie.z_meters = FORMATTER.format(robbie.z);
}
else {
robbie.z = 0.0;
robbie.z_meters = "";
}
str = tokens.nextToken().trim();
if (str.length() > 0) {
robbie.or = Double.parseDouble(str);
......@@ -537,6 +549,7 @@ public class RoboTrack extends JApplet {
static class MyTableModel extends AbstractTableModel {
private String[] columnNames = {"Pname", "Vname",
"X (meters)", "Y (meters)",
"Z (meters)",
"O (degrees)",
"Dest-X", "Dest-Y", "Dest-O",
"Battery %", "Voltage", "Updated"
......@@ -575,13 +588,14 @@ public class RoboTrack extends JApplet {
case 1: return robbie.vname;
case 2: return robbie.x_meters;
case 3: return robbie.y_meters;
case 4: return robbie.or_string;
case 5: return robbie.dx_meters;
case 6: return robbie.dy_meters;
case 7: return robbie.dor_string;
case 8: return robbie.battery_percentage;
case 9: return robbie.battery_voltage;
case 10: return robbie.update_string;
case 4: return robbie.z_meters;
case 5: return robbie.or_string;
case 6: return robbie.dx_meters;
case 7: return robbie.dy_meters;
case 8: return robbie.dor_string;
case 9: return robbie.battery_percentage;
case 10: return robbie.battery_voltage;
case 11: return robbie.update_string;
}
return "Foo";
}
......
......@@ -765,6 +765,7 @@ CREATE TABLE location_info (
building varchar(32) default NULL,
loc_x int(10) unsigned NOT NULL default '0',
loc_y int(10) unsigned NOT NULL default '0',
loc_z float default NULL,
orientation float default NULL,
contact tinytext,
phone tinytext,
......
......@@ -2483,3 +2483,8 @@ last_net_act,last_cpu_act,last_ext_act);
update os_info set reboot_waittime=150 where OS='Linux' or
OS='FreeBSD' or OS='NetBSD';
update os_info set reboot_waittime=180 where OS=Windows';
1.317: Add loc_z to location_info table.
alter table location_info add loc_z float default NULL after loc_y;
......@@ -125,6 +125,7 @@ while ($row = mysql_fetch_array($query_result)) {
$node_id = $row["node_id"];
$loc_x = $row["loc_x"];
$loc_y = $row["loc_y"];
$loc_z = $row["loc_z"];
$orient = $row["orientation"];
if ((isset($pid) && $pid == $row["pid"]) &&
......@@ -142,6 +143,9 @@ while ($row = mysql_fetch_array($query_result)) {
else {
$locations[$node_id] = "x=$loc_x, y=$loc_y pixels";
}
if (isset($loc_z)) {
$locations[$node_id] .= ", z=" . sprintf("%.2f", $loc_z) . " meters";
}
if (isset($orient)) {
$locations[$node_id] .= ", o=" . sprintf("%.1f", $orient) . "°";
}
......
......@@ -41,14 +41,16 @@ if (isset($fake)) {
#
$x1 = 100;
$y1 = 100;
$z1 = 0.5;
$x2 = 700;
$y2 = 200;
$z2 = 1.5;
$i = 0;
do {
echo "garcia1, robbie, $x1, $y1, 90.0, 700, 300, -90.0, 10, 20\n";
echo "garcia2, mary, $x2, $y2, 0.0, 200, 100, 90.0, 50, 60\n";
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";
flush();
sleep(1);
......@@ -89,6 +91,7 @@ while (1) {
$vname = $row["vname"];
$x = $row["loc_x"];
$y = $row["loc_y"];
$z = $row["loc_z"];
$or = $row["orientation"];
$dx = $row["destination_x"];
$dy = $row["destination_y"];
......@@ -102,6 +105,8 @@ while (1) {
if (!isset($vname))
$vname = $pname;
if (!isset($z))
$z = "";
if (!isset($or))
$or = "";
if (!isset($dx)) {
......@@ -114,7 +119,7 @@ while (1) {
if (!isset($bper))
$bper = "";
echo "$pname, $vname, $x, $y, $or, $dx, $dy, $dor, $bper, $bvolts\n";
echo "$pname, $vname, $x, $y, $z, $or, $dx, $dy, $dor, $bper, $bvolts\n";
}
flush();
sleep(1);
......
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