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