Software Patch Fixes Mars Curiosity Rover's Auto-focus Glitch 53
An anonymous reader writes: Scientists from Los Alamos National Laboratory have successfully uploaded and applied a software patch to NASA's Curiosity Rover on Mars. The patch fixes a focusing problem that cropped up in November when the laser that helps to focus one of its cameras failed. "Without this laser rangefinder, the ChemCam instrument was somewhat blind," said Roger Wiens, ChemCam principal investigator at Los Alamos. "The main laser that creates flashes of plasma when it analyzes rocks and soils up to 25 feet [7.6 meters] from the rover was not affected, but the laser analyses only work when the telescope projecting the laser light to the target is in focus." Before the fix, scientists had to shoot images at nine different focus settings to distill a decent set of data. Now, they say the new software results in better images in a single shot than even before the laser broke down. The program that runs the instrument is only 40 kilobytes in size.
Los Alamos (Score:1)
I worked at Los Alamos National Lab for a number of years. There are some very skilled people there who are very dedicated. America can do good science when it has the will. Which unfortunately isn't so often.
Re: (Score:2)
Source code? (Score:5, Interesting)
Apollo space program is documented in great detail. Even the software running in the flight computers is nowdays available and you can run the whole thing in a virtualized guidance computer. http://www.ibiblio.org/apollo/
Does anyone have any idea what's the case with probes and landers? I know they are mostly running VxWorks, but I'd love to take a peek on how some of the routines are actually implemented.
Re:Source code? (Score:4, Insightful)
Me, I wish the code for the Space Shuttle was available. The shuttles are now decommissioned and sitting in museums and no country wanting to build any kind of shuttle or space plane is going to be replicating a 40 year old American design when there are far better ways to do it nowadays so there shouldn't be any risk to national security in releasing the code (not to mention that the code alone isn't enough to rebuild the computer system, let alone the whole shuttle).
Re: (Score:1)
Conceivably some of the shuttle guidance systems and such could be useful for ballistic missile development? At least, it could be informational for developing such systems, if not directly usable.
Re: (Score:1)
Regardless, the software in the rover that the article is talking about doesn't contain anything related to missile launching and is developed using public funding.
The only reason to not make the rover software publicly available is that it could benefit other nations space programs. This in itself wouldn't harm the US space program, unless you consider dick-waving to be the most important thing in the world.
Sharing software makes the world richer, not poorer. Considering that the software written on the ta
Re: (Score:1)
If you really don't understand what the word 'richer' means in the context in which the parent poster was using it, then I truly feel sorry for you.
Re: (Score:2)
Export Controls, Licenses & Money (Score:1)
Software for spacecraft is potentially export controlled either under ITAR or EAR, so just throwing it out on github or source-forge isn't likely. It's true that much of what's running on Curiosity probably is NOT subject to export control (or is "dual-use"), but it would be difficult and tedious (read - expensive) to separate out the pieces and get them reviewed for public release. Space missions are always budget constrained, so do you want to collect more science data or get software released?
As it hap
Re: Source code? (Score:1)
http://code.nasa.gov/#/
Still a hack, but way better than nothing. (Score:5, Interesting)
This fix still requires much of the resources of the previous method, essentially bracketing the shot and picking the best one. This means it will still take just as long to obtain each image, but apparently that wasn't a huge problem. What this saves is something precious though: bandwidth. Now the rover is picking the best shot, instead of sending a bunch of blind guesses and making us sort it out. I suspect that if the bandwidth wasn't precious, they wouldn't have bothered improving on the existing workaround, so it must have been worth all the trouble.
Re: (Score:2)
This means it will still take just as long to obtain each image
Not having to send the images to earth saves a lot of time.
Re: (Score:2, Informative)
And more importantly, it saves a lot of power. The MMRTG power supply is supposed to last 14 years. However, that's at very low consumption levels
RTGs do not work that way; they're decaying whether you use the energy or not.
Re: (Score:2, Interesting)
Technically you don't even need a range finder.
It's possible to do autofocus through-the-lens with phase detection [wikipedia.org] or contrast detection [wikipedia.org]:
Contrast detection places different constraints on lens design when compared with phase detection. While phase detection requires the lens to move its focus point quickly and directly to a new position, contrast detection autofocus instead employs lenses which can quickly sweep through the focal range, stopping precisely at the point where maximum contrast is detected. This means that lenses designed for phase detection often perform poorly on camera bodies which use contrast detection.
From a link in TFA [lanl.gov]:
They figured out that if they discarded a lot of the old code on board their distant subject, they could make room for software that could command the instrument to take the nine images on its own and analyze them on-board to find the best focus.
I guess they didn't have room on the device to code up a binary search of the contrast method before acquiring a single image?
Re: (Score:2)
Well you'd still have to take images to tell the current state of the contrast, after all the camera can only "see" through the lenses when taking a picture. Also a binary search is likely suboptimal for such things, an interpolation search is likely to be far more efficient since you presumably have enough information after the first few images to make a good guess as to where in the spanned range the "sweet spot" will be.
Re: (Score:2)
You could also not have to do it at all and use an EDOF system (such as shown in this demo [youtube.com]). Its just not a software solution and has to be constructed from the beginning with the lens and the camera (you voluntary insert aberrations that will make the system blurry "the same way" in some larger range, but this blur is easily invertible by a simple image Wiener deconvolution).
Re:Still a hack, but way better than nothing. (Score:4, Informative)
so it sounds like a simple FFT to pick one with biggest high frequency coefficients. You can do it yourself smapping pictures at different focus and simply comparing file sizes: better focus = finer detail = more high frequency content = more information to store. Think JPG Quantization table and quality setting.
Re: (Score:2)
"Only" 40 Kilobytes ?! (Score:4, Funny)
thats four times LiteOS! Get some Huawei developers work on this, and they'll reduce this patch to 64 bytes.
Re:"Only" 40 Kilobytes ?! (Score:4, Funny)
"64 bytes oughtta be enough for any Martian."
- Marvin Gates
Re:"Only" 40 Kilobytes ?! (Score:5, Funny)
"Get some Huawei developers work on this, and they'll reduce this patch to 64 bytes."
And the hardened, high-capacity espionage backdoor channel to the PLA will serve mankind well should a solar flare takes out our primary communications channel with Curiosity.
Re: (Score:2)
Yeah I was going to say, I wrote a crude flight simulator, including the display drivers for my Arduino and SSD1306 OLED display, that weighs in at 31KB. A piece of code to focus a laser should be less than that.
Re: (Score:2)
It's not clear what exactly the piece of code does. The "instrument" could refer to the ChemCam.
That's one printf! (Score:2)
40 kb? So that's like one call to printf("%s",szMars) ...
The program that runs the instrument is only 40 ki (Score:3)
We need these guys to work on Firefox. Chromium too! Hell, just turn them loose on Windows!
Re: (Score:1)
40k is a lot of code, when it's not been written in layers of glop-gloop abstraction.
Re: (Score:2)
was just gonna say that... 40kb is quite a lot of assembly, or even C as long as it's not using bloated libraries.
Does anyone here happen to know if they code the rovers in assembly? or code the patches in assembly?
Re: (Score:3)
Nobody in their right mind is going to write rover code in assembly. Too much work, and too much chance of a silly mistakes fucking things up, while the actual code saving is not much. It's much easier and cheaper to add some extra memory instead.
Re: (Score:1)
Nobody in their right mind is going to write rover code in assembly. Too much work, and too much chance of a silly mistakes fucking things up, while the actual code saving is not much. It's much easier and cheaper to add some extra memory instead.
This guy obviously hasn't had to pay for radhard SEU immune SRAM.
Not a fix... (Score:5, Informative)
If I read the article(s) correctly, problem was caused by failure of a small 2nd laser used for range finding. It seems that failure wasn't solved. Permanently out of action? Who knows.
Workaround was to take several shots at different focus settings, and have home base sort out the data. Improved workaround is to take several shots at different focus settings, have software on-site figure out which are the best, and only send that data back home.
To the editors (Score:5, Interesting)
If you are going to have a story like this it would be good form to remember the H, aka HOW from who,what,when,where, why and HOW of a journalism article. At some point in the past this was a site oriented to the technical community, most of whom are very interested in the how. You might even think that for the most part the when, why, where and who are all at the who cares level. (Mars being an exception)
Re: (Score:2)
Re: (Score:1)
and pay some technical debt (Score:2)
"Now, they say the new software results in better images in a single shot than even before the laser broke down."
So it was a good Oportunity to pay some technical debt.