JAI, JPEG2000 and Eclipse/RCP

So during my work here at NASA JPL these last two weeks, I've been integrating Ardor3D, streaming clipmap-based terrain and a Wii controller into an Eclipse RCP application for viewing on a 3/4 round CAVE projection screen. Things have gone very smoothly, with the exception of one head-scratcher that stopped us in our tracks when moving from a standard Ardor canvas to the RCP application.

We stream in terrain information as loss-less jpeg2000 images (to save bandwidth) and use JAI to decode. Our problem emerged as soon as we moved from a standalone native canvas to RCP and our terrain stopped loading. For about three hours we debugged the network, the shaders, the rcp code and dug deep into the bowels of JAI before realizing that for some reason JAI stopped being able to decode jpeg2000 images.

After a lot of debugging, the manager of the group here (one Mark Powell, not the jME guy,) recalled an issue with JAI where there were assumptions in JAI about classloaders and static initializers and these assumptions were false in RCP. The fix was to manually force initialization of the jpeg2000 reader service with a small static block of code like so:

{
J2KImageReaderSpi spi = new J2KImageReaderSpi();
IIORegistry.getDefaultInstance().registerServiceProvider(spi);
}


And just like that, 3 hours of head scratching was fixed with 2 lines of code. I post this in the hopes that it saves someone else those same hours.


In other news, I was fortunate enough to be at JPL this week for the first "test drive" of the new mars rover "Curiosity". Several dozen folks who had obviously invested many hours of blood, sweat and tears into the project crowded a narrow observation deck to gaze down at the clean room floor below. Curiosity is a good deal larger than the MER rovers (Opportunity and Spirit) we've come to be familiar with over the last decade. It also has a lot more science equipment on board such as a laser that shoots out of one of its cameras, blasting away the top layer of a rock to see into the raw material beneath.

Curiosity was hooked to a large umbilical cord and men and women in white clean room suits stood around it waiting for something to happen. About 20-25 minutes crept by in the rapidly warming observation deck when suddenly, the rover lurched forward at a slow crawl and drove for perhaps 2 meters before halting at the edge of the mat it stood on.

Ok, not exactly Hollywood, but the crowd on the platform broke out into applause with smiles all around. Good times.

1 comments:

S. A. Slack said...

Exciting! Glad all went so well with your work there. And thanks for sharing this picture and your take on the new rover. I would love to have been there myself!