Author Archives: pgfeldman

Mike 2.27.2011

  • Imported a fresh build of Visibility
  • The server was down when I got to the customer site this morning.  I contacted someone who Phil suggested as well as the EDC support center.  The system came back up around 9:40 AM without word from anyone.
  • Deployed the new visibility, still not able to log in with the data navigator or the account managers tools.
  • Reviewed required server updates from Denise.  Tried to apply several but got errors.  Asked Denise who to contact.
  • Tried to listen to the FGM all hands meeting recording, doesn’t appear to be uploaded correctly
  • Created a debugging application to try and figure out why visibility isn’t working at site
  • Working on a “Home” page for the vis tool which will act as a launchpad for PPM, PPA, and the data visualizations

Tom DeVito 2.24.2012

Start: 10:00

  • Working on the controllers for gathering sensor data and sound controls
  • Made some changes to the base classes for sound control so that they accepted value between 0-255
  • Made some more minor changes to the the Amp and Midi classes to make execution of commands easier.
  • Decided on a naming scheme for variables in the DataDiction.  The finger name underscore property(ex. thumb_vol is thumb volume)
  • My friend Chris came by to make a car which turns and travels north.  He was using a compass IC which communicated to the Arduino using I2c.
  • I found out that it is a good thing I have not updated the arduino IDE yet.  There were changes made which would break my code.  I will have to update this eventually but I want to get everything working first.
  • atan2(y, x) will find the angle in radians from the origin.  This method automatically fixes it to work past 90 degrees.
  • I used my com classes and console to print out the data to help him test the compass.  Simply dropped it in and set a toString on his class.
  • We were able to get his robot to work.  I’ll show you the video tomorrow.

End: 6:00

Phil 2.24.12

8:30 – FP

  • I think I found GLSL documentation! http://www.opengl.org/sdk/docs/manglsl/
  • A working convolution filter that blurs anything above a certain luminance:
  • #version 150
    // glow.fs
    // outputs the color negative of a texture
    //
    
    in vec2 vTexCoord;
    
    uniform int screenWidth;
    uniform int screenHeight;
    
    uniform sampler2D textureUnit0;
    
    vec4 getTexOffset(const sampler2D texUnit, const vec2 texCoord, const float dx, const float dy){
    	vec2 offset = texCoord + vec2(dx, dy);
    	return texture(textureUnit0, offset);
    }
    
    void main(void)
    {
    	float dx = 1.0 / float(screenWidth);
    	float dy = 1.0 / float (screenHeight);
    
    	float x;
    	float y;
    	vec4 blurSum = vec4(0, 0, 0, 0);
    	float patchSize = 4.0;
    	float xmin = -patchSize*dx;
    	float xmax = patchSize*dx+dx*0.5;
    	float ymin = -patchSize*dy;
    	float ymax = patchSize*dy+dx*0.5;
    	float count = 0;
    
    	for(x = xmin; x < xmax; x += dx){
    		for(y = ymin; y < ymax; y += dy){
     			blurSum += getTexOffset(textureUnit1, vTexCoord, x, y);
     			if(count > 1000){
    				discard;
    			}
    			count += 1.0;
    		}
    	}
    	float weight = 1.0/count;
    	vec4 blured = vec4(blurSum.r*weight, blurSum.g*weight, blurSum.b*weight, 1.0);
    	vec4 sharp = texture(textureUnit0, vTexCoord);
    
    	float luminance = blured.r + blured.g + blured.b;
    	if(luminance > 1.0){
    		gl_FragColor = blured;
    	}else{
    		gl_FragColor = sharp;
    	}
    }
  • And here’s the picture it produces. Note the sharp moon and gridlines with the blurry sun 🙂
  • Next on the hit parade, add a test to see if the corners of the convolution filter touch anything above the luminance threshold and discard if it doesn’t. My guess is that should speed up things a lot. Done. Discovered that there are some odd problems that crop up as the screen gets made quite large. This could have something to do with the fact that I’m not checking to see that the convolution patch’s coordinates can run off the texture (i.e not clamped between 0.0 and 1.0)?
  • Migrate the screen drawing to a DrawableObject class. I’m pretty sure it should work there, as long as it’s called after postDraw3D(). In fact, it should be possible to have multiple screen drawing classes, though I’m not sure why.
  • Add shader directory to svn repo – done
  • And it appears that after a while, something is clogging the graphics pipeline, because the drawing slows way done. This does look like it’s due to the shader, as the neg.fs doesn’t seem to be slowing things down. Yep,  adding clamping to the glow.fs shader fixed that problem. Still have the problem where the screen texture gets messed up if the window gets too big…
  • So here’s the better version of the fragment shader
  • #version 150
    // glow.fs
    // outputs the color negative of a texture
    //
    
    in vec2 vTexCoord;
    
    uniform int screenWidth;
    uniform int screenHeight;
    
    uniform sampler2D textureUnit0;
    
    void luminanceTest(const sampler2D texUnit, const vec2 texCoord, const float xmin, const float xmax, const float ymin, const float ymax, const float luminance){
    	vec2 ll = clamp(texCoord + vec2(xmin, ymin), 0.0, 1.0);
    	vec2 lr = clamp(texCoord + vec2(xmax, ymin), 0.0, 1.0);
    	vec2 ur = clamp(texCoord + vec2(xmax, ymax), 0.0, 1.0);
    	vec2 ul = clamp(texCoord + vec2(xmin, ymax), 0.0, 1.0);
    
    	vec4 total = texture(texUnit, ll);
    	total += texture(texUnit, lr);
    	total += texture(texUnit, ur);
    	total += texture(texUnit, ul);
    
    	float weight = 1.0/4.0;
    	float val = (total.r + total.g + total.b)*weight;
    	if(val < luminance){
    		discard;
    	}
    }
    
    vec4 getTexOffset(const sampler2D texUnit, const vec2 texCoord, const float dx, const float dy){
    	vec2 offset = texCoord + vec2(dx, dy);
    	clamp(offset, 0.0, 1.0);
    	return texture(texUnit, offset);
    }
    
    void main(void)
    {
    	float dx = 1.0 / float(screenWidth);
    	float dy = 1.0 / float (screenHeight);
    
    	float x;
    	float y;
    	vec4 blurSum = vec4(0, 0, 0, 0);
    	float patchSize = 4.0;
    	float xmin = -patchSize*dx;
    	float xmax = patchSize*dx+dx*0.5;
    	float ymin = -patchSize*dy;
    	float ymax = patchSize*dy+dx*0.5;
    	float count = 0;
    
    	luminanceTest(textureUnit0, vTexCoord, xmin, xmax, ymin, ymax, 1.0);
    
    	for(x = xmin; x < xmax; x += dx){
    		for(y = ymin; y < ymax; y += dy){
     			blurSum += getTexOffset(textureUnit0, vTexCoord, x, y);
     			if(count > 1000){
    				discard;
    			}
    			count += 1.0;
    		}
    	}
    	vec4 sharp = texture(textureUnit0, vTexCoord);
    	float weight = 1.0/count;
    	vec4 blured = vec4(blurSum.r*weight, blurSum.g*weight, blurSum.b*weight, sharp.a);
    
    	float luminance = blured.r + blured.g + blured.b;
    	if(luminance > 1.0){
    		gl_FragColor = blured;
    	}else{
    		gl_FragColor = sharp;
    	}
    }

Mike 2.24.2012

  • Normal database backup and connectivity testing
  • Brought in a version of Visibility and Visibility Scripting
  • Reviewed some of the required updates from Denise
  • Worked with Dong to try and deploy Visibility and Visibility Scripting
    • Visibility Scripting is working after fixing some errors in the properties file
    • Visibility doesn’t seem to be correctly reading the properties file, not sure what they error is but the swf is from July 2011 so I will try building a new one and bringing that one in
  • Rebuilt IngestManager and AccountManagers
  • Attempting to Build PPM and PA:
    • Project Assistant built fine and I imported Dong’s database of fake data
    • PPM is having remote object problems

Tom DeVito 2.23.2012

Start: 10:00

  • Finished changes to the Data Dictionary.
  • Tested remote data.  Echo test worked when only one entry was sent but failed when multiple entries were sent.
  • Found the problem in the import data method.
  • Worked a little more on the Arduino Controllers.  Changed the variables to be in 0-255 range.

End: 6:00

Mike 2.23.2012

  • Regular back up and connectivity checks this morning
  • Deployed a fix for a broken user select button in the Create Funding Request dialog
  • Met with Tangie and discussed:
    • Connectivity through outside networks
    • Getting a link to our stuff from a more official site
    • Difficulties creating a funding request, Tangie was able to while I was watching but we’re still trying to get a hold of Christina and diagnose her difficulties
  • Contacted Denise Price regarding server maintenance, she said she would email me the details
  • Contacted the authentications server helpdesk to try and get our system added to the production list from the test list
  • Brought Dong up to speed about yesterday’s meeting
  • Working on building a fresh version of Visibility, PPM, and PA on my laptop
    • Need to find / install a flex 3.5 SDK
    • Need my Eclipse to cooperate and quit locking up
    • Got it built!

Mike 2.22.2012

  • Normal backup / connectivity testing in the morning
  • Deployed an update to fix mismatching POCs when creating a funding request
  • Spoke to Tangie about the update
  • Meeting with Mike H. and others about the Vis Tool Status.  Results of the meeting:
    • Next week we need to do ‘internal’ testing of outside connections
    • The following week we need to provide a demo of the capability of PPM, PA, and Visibility
    • The next week we will do tests with individuals from site, before that we will test their connectivity and PKI support

Phil 2.23.12

8:00 – 4:30 FP

  • Step 1 – make a screen-aligned ortho polygon and make sure it’s drawing correctly with a simple shader, and that the text overlay still works – done
  • Step 2 – copy texture code over from modified pix_buffs.cpp – done. Other textures seem to mess everything up.
    • Added glActiveTexture(GL_TEXTURE0); to SolarSystem, which fixed the missing texture problem, but the screen texture still gets messed up. GOing to try putting in pieces of SolarSystem to find where it breaks, since everything works fine with just the Grid
  • Filling out matrix
  • Back to shaders. For some reason, I have to make sure that the screenwidth is evenly divisible by 4. Not sure why, but it’s easily fixed. So now we have this!
  • Committed everything to svn

Tom DeVito 2.22.2012

Start: 10:00

  • I got the Data Dictionary working in a way which makes it so only the publisher can change the data.
  • This still requires you to call a setData command to change the data in data dictionary.  I am thinking an update method, which is called either in the post process of the class or during the system loop, could cycle through the entries and compare the data in the dictionary to the data in the data pointer.  This way you would be able to set your local variables normally and the Dictionary would still be able to track changes.  Its probably better this happens once per program loop, as it would take a lot of cycles each time to compare the data.  I like this approach because if you want to add a pre-made class not designed for the system, you only have to publish or subscribe the variables you need and its “set and forget” from there.
  • Changed all the char and char* which were not being used for anything having to do with characters to uint8_t.  Although it technically doesn’t matter to store non char values in a char, it will not print correctly.  Also the send and receive base methods of windows and the arduino, use this by default instead of unsigned char.
  • Made an arduino sandbox for testing.  Added the com library for testing of remote data.

End: 6:00

Phil 2.22.12

8:00 – 1:00 FP

  • More rendering to a texture
  • Yay! Progress!
  • Yeah, I know it doesn’t look like much, but it means I’m that much less confused…
  • Deleting unneeded code for multiple buffers, malloc, etc.
  • Refresh rate drops on screen resize. Why?

1:00 – 4:30 VISIBILITY

  • VisTool Review

Tom DeVito 2.21.2012

Start: 9:00

  • Successfully passed data across the wire using the data dictionary
  • Working on figuring out a way to track if data is changed.  A method within the Data Dictionary to change the data can accomplish this.  The problem is locking manual sets.  Phil suggested using const variables.  This seems to work in a sense but I am not sure how to change it later.  I am thinking the parameter in the set method will have to be cast to whatever type the data is supposed to be.
  • Started working on the arduino controllers.  Need to ask Phil how he wants the data output.

End: 5:00

Phil 2.21.12

8:30 – FP

  • Reworking Gl_ShaderWindow so that it renders to a texture. Slow, slow progress.
  • Downloaded the code that goes with the OpenGL 4.0 Shading Cookbook. They seem to be using screen-aligned quads, which is more in line with the blur example. Going to work with that for a while.
  • Made a copy of the pix_buffs demo, and am now trying to simplify

Tom DeVito 2.20.2012

Start: 9:30

  • Increased my echo test to do 1000 passes to see if it would continue to run consistently.  The RTS state still seems to be sending too many times on pass back from the PC.  I was kinda in a rush when I finally got this working on friday, its possible I only fixed this on the arduino side.  When this was happening on the arduino, the buffer was becoming completely corrupted because it was overflowing.
  • This problem seems to have resolved itself.  I think the PC library was never rebuilt after I solved the problem.
  • Changed the has data test condition so that data starting with 0 would still work.
  • Strangely, if you try to receive a packet of 128 bytes on the arduino, the serial.available() method never returns true, so nothing is read.  However, if you send a 127 byte packet and then send a 1 byte messages and have separate calls to the read method for each, it doesn’t have a problem with this.  This might be a bug in the serial class but I want it to work this way so its no big deal.
  • Flushing the arduinos send buffer after each send causes some issues when the PC was running without delay.
  • Added the capability to send data buffers larger then 127.  Since the arduino will not let me send 128 bytes at a time, the max buffer size is 508 instead of 512.
  • Moved the Data Dictionary into the Communication library since it is necessary for sending of data easily.
  • Refreshed my memory on how the import and sending remote data should work.
  • Changed these methods to work with the updated comutil methods.

End: 5:30

Phil 2.20.12

9:30 – 3:00 FP

  • Biting the bullet and installing R on fgmdev. Installed, and working on getting all the packages in.
  • Installed the folllowing
    • install.packages(“Rserve”)
    • apt-get install r-cran-car then library(car)
    • install.packages(“vcd”)
    • apt-get install r-cran-gplots then library(gplots)
    • install.packages(“pwr”)
  • had to re-run library(gplots) so that plotmeans was visible correctly
  • After installing all the packages, I bounced Rserve, and then remembered that I had to bounce tomcat. Which took a *while* to restart.
  • everything appears to be running correctly 🙂

Here’s the current list:

Packages in library '/usr/local/lib/R/site-library':

colorspace              Color Space Manipulation
mvtnorm                 Multivariate Normal and t Distributions
pwr                     Basic functions for power analysis
Rserve                  Binary R server
vcd                     Visualizing Categorical Data

Packages in library '/usr/lib/R/site-library':

car                     Companion to Applied Regression
gdata                   Various R programming tools for data
                        manipulation
gplots                  Various R programming tools for plotting data
gtools                  Various R programming tools
multcomp                Simultaneous Inference in General Parametric
                        Models
mvtnorm                 Multivariate Normal and t Distributions

Packages in library '/usr/lib/R/library':

base                    The R Base Package
boot                    Bootstrap R (S-Plus) Functions (Canty)
class                   Functions for Classification
cluster                 Cluster Analysis Extended Rousseeuw et al.
codetools               Code Analysis Tools for R
datasets                The R Datasets Package
foreign                 Read Data Stored by Minitab, S, SAS, SPSS,
                        Stata, Systat, dBase, ...
graphics                The R Graphics Package
grDevices               The R Graphics Devices and Support for Colours
                        and Fonts
grid                    The Grid Graphics Package
KernSmooth              Functions for kernel smoothing for Wand & Jones
                        (1995)
lattice                 Lattice Graphics
MASS                    Main Package of Venables and Ripley's MASS
methods                 Formal Methods and Classes
mgcv                    GAMs with GCV smoothness estimation and GAMMs
                        by REML/PQL
nlme                    Linear and Nonlinear Mixed Effects Models
nnet                    Feed-forward Neural Networks and Multinomial
                        Log-Linear Models
rpart                   Recursive Partitioning
spatial                 Functions for Kriging and Point Pattern
                        Analysis
splines                 Regression Spline Functions and Classes
stats                   The R Stats Package
stats4                  Statistical Functions using S4 Classes
survival                Survival analysis, including penalised
                        likelihood.
tcltk                   Tcl/Tk Interface
tools                   Tools for Package Development
utils                   The R Utils Package
  • Came upon an interesting thing: http://rapache.net/ it’s a pretty slick VISIBILITY-ish looking thing. Need to spend some time figuring out how it works. Not all that clear yet.
  • OK, back to shaders and such.
  • And I just got why rendering the entire scene to a framebuffer that you then process is important. It’s because you can post process the texture (i.e. the entire scene) to get blur, bloom, and other effects. Cool. Well, I know what I’m doing tomorrow.