Quote:
Originally Posted by loafdog
Please post your changes here so everyone can see/try it out.
Our smartdashboard is crashing as well after we added the camera widget.
|
OK, but as I've said, I can't explain why this prevents the crash. It isn't the obvious thing validateDisposed, so it must be a timing thing.
In WPICameraExtension.java, around line 74 my code looks like this:
try {
image = cam.getNewImage(5.0);
if (image instanceof WPIColorImage) {
System.out.println("process image width:" + image.getWidth() + " height:" + image.getHeight());
drawnImage = processImage((WPIColorImage) image).getBufferedImage();
SwingUtilities.invokeLater(draw);
} else if (image instanceof WPIGrayscaleImage) {
drawnImage = processImage((WPIGrayscaleImage) image).getBufferedImage();
SwingUtilities.invokeLater(draw);
}
} catch (final Exception e) {
What I added was just before the call to processImage I print out the width and height of the image. 640x480 is what I get if I actually run from command line with a console, but if I just run First Dashboard I get no printouts.
Here is the 1 line print:
System.out.println("process image width:" + image.getWidth() + " height:" + image.getHeight());
Build it, make a new WPICameraExtension.jar, copy it to Program Files\SmartDashboard\extensions perhaps first saving the old jar file somewhere, and then just run it as usual.
The jar is also available at
http://athenian-arc.googlecode.com/f...aExtension.jar