Skip to content

Commit

Permalink
radar linux stabilizing
Browse files Browse the repository at this point in the history
  • Loading branch information
[email protected] committed Jan 25, 2012
1 parent 8ba60a9 commit 9325c37
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 9 deletions.
5 changes: 2 additions & 3 deletions oculus/WEB-INF/src/developer/OpenNIRead.java
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ public class OpenNIRead implements IObserver<ErrorStateEventArgs>{
private static DepthGenerator depth;
private static DepthMetaData depthMD;
public boolean depthCamInit = false;
public boolean depthCamReading = false;

@Override
public void update(IObservable<ErrorStateEventArgs> arg0,
Expand Down Expand Up @@ -38,16 +37,16 @@ public void startDepthCam(Application app) {
else { depth.startGenerating(); }
}
catch (Throwable e) { e.printStackTrace(); }
depthCamReading = true;
}

public void stopDepthCam() {
try {
depth.stopGenerating();
context.release();
depthCamInit = false;
} catch (StatusException e) {
e.printStackTrace();
}
depthCamReading = false;
}

public int[] readHorizDepth(int y) {
Expand Down
12 changes: 9 additions & 3 deletions oculus/WEB-INF/src/oculus/FrameGrabHTTP.java
Original file line number Diff line number Diff line change
Expand Up @@ -88,10 +88,15 @@ private void radarGrab(HttpServletRequest req, HttpServletResponse res)
//render background
g2d.setColor(new Color(10,10,10)); // was 10 10 10
g2d.fill(new Rectangle2D.Double(0, 0, w, h));

// too close out of range background fill
g2d.setColor(new Color(23,25,0));
int r = 40;
g2d.fill(new Ellipse2D.Double( w/2-r, h-1-r*0.95+voff, r*2, r*2*0.95));

// retrieve & render pixel data and shadows
int maxDepthInMM = 3500;
if (app.openNIRead.depthCamReading == true) {
if (app.openNIRead.depthCamInit == true) {
int[] xdepth = app.openNIRead.readHorizDepth(120);
int[] dataRGB = {0,255,0}; // sensor data pixel colour
g2d.setColor(new Color(0,70,0)); // shadow colour
Expand All @@ -114,7 +119,7 @@ private void radarGrab(HttpServletRequest req, HttpServletResponse res)

// dist scale arcs
g2d.setColor(new Color(100,100,100));
int r = 100;
r = 100;
g2d.draw(new Ellipse2D.Double( w/2-r, h-1-r*0.95+voff, r*2, r*2*0.95));
r = 200;
g2d.draw(new Ellipse2D.Double( w/2-r, h-1-r*0.95+voff, r*2, r*2*0.95));
Expand Down Expand Up @@ -142,7 +147,8 @@ private void radarGrab(HttpServletRequest req, HttpServletResponse res)
res.setContentType("image/gif");
OutputStream out = res.getOutputStream();
ImageIO.write(image, "GIF", out);

out.close();
image.flush();
}

}
6 changes: 3 additions & 3 deletions oculus/javascript/client.js
Original file line number Diff line number Diff line change
Expand Up @@ -2185,12 +2185,12 @@ function radar(mode) {
popupmenu('context', 'show', x, y, str, null, 1, 0);
}
if (mode=="off") {
clearTimeout(radartimer);
lagtimer = new Date().getTime(); // has to be *after* message()
document.getElementById("radarimg").src="";
// document.getElementById("radarimg").src="";
popupmenu("context", "close");
}
if (mode=="shutdown") { // unused
clearTimeout(radartimer);
callServer("opennisensor", "off");
message("sending opennisensor off " + str, sentcmdcolor);
}
Expand All @@ -2199,7 +2199,7 @@ function radar(mode) {
function radarrepeat() {
clearTimeout(radartimer);
// radartimer = setTimeout("document.getElementById('radarimg').src='frameGrabHTTP?"+new Date().getTime()+"'; radarrepeat();", 100);
radartimer = setTimeout("document.getElementById('radarimg').src='frameGrabHTTP'; radarrepeat();", 100);
radartimer = setTimeout("document.getElementById('radarimg').src='frameGrabHTTP'; radarrepeat();", 250);
}


Expand Down

0 comments on commit 9325c37

Please sign in to comment.