Commit 7b5e1055 authored by Leigh B. Stoller's avatar Leigh B. Stoller

Another small fix; Do not check the exclusion zone around a robot when

moving that robot!
parent e545cc0f
...@@ -356,6 +356,13 @@ sub callbackFunc($$$) { ...@@ -356,6 +356,13 @@ sub callbackFunc($$$) {
$val = int($val * $PPM); $val = int($val * $PPM);
push(@event, "YMAX=$val"); push(@event, "YMAX=$val");
} }
elsif ($key eq "ROBOT" || $key eq "robot") {
if (exists($nodeids{$val})) {
// Convert to phys nodeid.
$val = $nodeids{$val};
}
push(@event, "ROBOT=$val");
}
} }
my $evstr = "TYPE=AREA,ID=$id,ACTION=$evtype"; my $evstr = "TYPE=AREA,ID=$id,ACTION=$evtype";
$evstr .= "," . join("," ,@event) $evstr .= "," . join("," ,@event)
......
...@@ -349,7 +349,8 @@ public class RoboTrack extends JApplet { ...@@ -349,7 +349,8 @@ public class RoboTrack extends JApplet {
String description; String description;
boolean dynamic = false; // A dynamically created Obstacle. boolean dynamic = false; // A dynamically created Obstacle.
Rectangle rectangle = null; // Only for dynamic obstacles. Rectangle rectangle = null; // Only for dynamic obstacles.
Rectangle exclusion = null; // Ditto, for the grey area. Rectangle exclusion = null; // Ditto, for the grey area.
String robbie = null; // Set to nodeid if a robot obstacle.
} }
Vector Obstacles = new Vector(10, 10); Vector Obstacles = new Vector(10, 10);
Dictionary ObDynMap = new Hashtable(); // Temp Obstacles only. Dictionary ObDynMap = new Hashtable(); // Temp Obstacles only.
...@@ -585,6 +586,7 @@ public class RoboTrack extends JApplet { ...@@ -585,6 +586,7 @@ public class RoboTrack extends JApplet {
int index; int index;
String action = ""; String action = "";
int x1 = 0, y1 = 0, x2 = 0, y2 = 0, id; int x1 = 0, y1 = 0, x2 = 0, y2 = 0, id;
String robotag = null;
id = Integer.parseInt(obid); id = Integer.parseInt(obid);
...@@ -616,6 +618,9 @@ public class RoboTrack extends JApplet { ...@@ -616,6 +618,9 @@ public class RoboTrack extends JApplet {
else if (key.equals("YMAX")) { else if (key.equals("YMAX")) {
y2 = Integer.parseInt(val); y2 = Integer.parseInt(val);
} }
else if (key.equals("ROBOT")) {
robotag = val;
}
} }
if (action.equals("CREATE")) { if (action.equals("CREATE")) {
// Is this (left over ID) going to happen? Remove old one. // Is this (left over ID) going to happen? Remove old one.
...@@ -625,13 +630,14 @@ public class RoboTrack extends JApplet { ...@@ -625,13 +630,14 @@ public class RoboTrack extends JApplet {
} }
// Must delay insert until the new Obstacle is initialized // Must delay insert until the new Obstacle is initialized
oby = new Obstacle(); oby = new Obstacle();
oby.id = id; oby.id = id;
oby.x1 = x1; oby.x1 = x1;
oby.y1 = y1; oby.y1 = y1;
oby.x2 = x2; oby.x2 = x2;
oby.y2 = y2; oby.y2 = y2;
oby.description = "Dynamic Obstacle"; oby.description = "Dynamic Obstacle";
oby.robbie = robotag;
oby.dynamic = true; oby.dynamic = true;
oby.rectangle = new Rectangle(x1, y1, x2-x1, y2-y1); oby.rectangle = new Rectangle(x1, y1, x2-x1, y2-y1);
oby.exclusion = new Rectangle(x1 - OBSTACLE_BUFFER, oby.exclusion = new Rectangle(x1 - OBSTACLE_BUFFER,
...@@ -725,8 +731,8 @@ public class RoboTrack extends JApplet { ...@@ -725,8 +731,8 @@ public class RoboTrack extends JApplet {
int rx2 = robbie.drag_x; int rx2 = robbie.drag_x;
int ry2 = robbie.drag_y; int ry2 = robbie.drag_y;
System.out.println("CheckforObstacles: " + rx1 + "," + //System.out.println("CheckforObstacles: " + rx1 + "," +
ry1 + "," + rx2 + "," + ry2); // ry1 + "," + rx2 + "," + ry2);
/* /*
* Check for overlap of this robot with each obstacle. * Check for overlap of this robot with each obstacle.
...@@ -761,13 +767,23 @@ public class RoboTrack extends JApplet { ...@@ -761,13 +767,23 @@ public class RoboTrack extends JApplet {
while (e.hasMoreElements()) { while (e.hasMoreElements()) {
Obstacle obstacle = (Obstacle)e.nextElement(); Obstacle obstacle = (Obstacle)e.nextElement();
/*
* Skip this Obstacle if its a robot Obstacle
* that was generated on the fly, and it refers
* to our self.
*/
if (obstacle.robbie != null &&
obstacle.robbie.equals(robbie.pname)) {
continue;
}
int ox1 = obstacle.x1 - OBSTACLE_BUFFER; int ox1 = obstacle.x1 - OBSTACLE_BUFFER;
int oy1 = obstacle.y1 - OBSTACLE_BUFFER; int oy1 = obstacle.y1 - OBSTACLE_BUFFER;
int ox2 = obstacle.x2 + OBSTACLE_BUFFER; int ox2 = obstacle.x2 + OBSTACLE_BUFFER;
int oy2 = obstacle.y2 + OBSTACLE_BUFFER; int oy2 = obstacle.y2 + OBSTACLE_BUFFER;
System.out.println(" " + ox1 + "," + //System.out.println(" " + ox1 + "," +
oy1 + "," + ox2 + "," + oy2); // oy1 + "," + ox2 + "," + oy2);
if (! (oy2 < ry1 || if (! (oy2 < ry1 ||
ry2 < oy1 || ry2 < oy1 ||
......
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