NASA’s Kepler space telescope is flying on an uncertain route, now that two of its four gyroscopic reaction wheels are out of commission. Without at least three working wheels, the spacecraft can’t position itself precisely enough to look for alien worlds.

Any engineering project has to cope with complications. On a manned mission, you can at least send a couple of astronauts out to investigate the problem, as with recent coolant leaks on the International Space Station. But what can you do when trouble arises on an unmanned craft in orbit around the Earth or speeding through the atmosphere of Mars? Oftentimes, it means that project’s done for and it’s back to the drawing board. NASA has had a history of learning from mistakes. Here are some of the lessons that have been hard-learned:

Double-check your units: The Mars Climate Orbiter, which launched in 1998, was supposed to circle the Red Planet and report back on Martian atmosphere and climate conditions. But as the craft was settling into orbit, NASA suddenly lost communication with the orbiter. The cause later turned out to be an embarrassing human error: While the software aboard the craft was written to understand instructions using the metric force unit, newtons, the computers back on Earth were writing out their instructions using another measurement, the pound-force (1 pound force is equal to about 4.4 newtons).

The discrepancy caused the satellite to enter the Martian atmosphere about 57 kilometers (35 miles) above the planet’s surface, instead of the 140 to 150 kilometer altitude it was supposed to enter at. The orbiter likely broke apart thanks to friction and atmospheric stresses, according to NASA.

Quality comes at a price: The year 1999 wasn’t a great one for NASA. The Mars Polar Lander failed less than a month after the Mars Climate Orbiter flew too low. It was eventually determined that the lander’s software misinterpreted vibrations in the craft’s legs as a signal that it had already touched down. In response, the onboard computer cut the engines while the lander was still around 100 feet in the air. Scientists estimated the lander hit the ground at about 72 feet per second.

In the late 1990s, NASA was under pressure to keep things fast and cheap.

"We're trying to do a whole lot more with less," NASA Flight Operations Manager Sam Thurman told the New York Times in 1999. "The public and Congress have told us, 'Space is neat, but it's got to be done at less than a billion dollars a pop.'"

The complete cost of both the orbiter and lander missions was $327.5 million. After those failures, NASA went back to the drawing board and emerged with the Spirit and Opportunity rovers, which successfully touched down on the opposite sides of Mars in 2004. Both robots operated much longer than expected -- Opportunity is still chugging along nine years after its initial mission ended. The total cost of the rovers: $800 million.

The most recent member of the Mars rover family, Curiosity, pulled off an intensely complicated landing maneuver last year, using a “sky crane” that lowered it down the last few meters to the ground. Now it’s beaming back some of the most detailed scientific data on Martian geology and possibly life-supporting conditions that we’ve ever seen. Curiosity’s price tag: $2.6 billion. Money talks -- and flies.

Learning from tragedies: The Apollo 1 disaster in 1967, in which three astronauts died during a launch pad test, revealed numerous design flaws in the Apollo capsule.

In response, the cabin atmosphere was changed to a mixture of oxygen and nitrogen, rather than the pure-oxygen air that helped fuel the blaze. The nylon space suits NASA astronauts wore, which were both flammable and contributed to static discharge that could have ignited the Apollo 1 fire, were redesigned with nonflammable Beta cloth, which is made from fiberglass and Teflon. Another major change was a redesigned hatch that opened outward instead of inward.

Fixing institutional culture: The Space Shuttle Challenger disaster in 1986 provoked intense scrutiny of NASA culture. The Rogers commission report that investigated the disaster found that NASA and Morton-Thiokol -- the company that made Challenger’s booster rocket -- knew about the flawed design of the O-ring but did nothing to correct it. Theoretical physicist Richard Feynman, one of the members of the committee, excoriated NASA management’s estimates of the space shuttle design’s failure probability as a thousand times less than some estimates from engineers.

“One reason for this may be an attempt to assure the government of NASA perfection and success in order to ensure the supply of funds,” Feynman wrote in an appendix to the report. “The other may be that they sincerely believed it to be true, demonstrating an almost incredible lack of communication between themselves and their working engineers.”

A 2003 report issued in the wake of the Columbia space shuttle disaster that year was heavily critical of NASA, saying the agency hadn’t improved its attitudes about safety since the Challenger disaster.

NASA lacks “effective checks and balances, does not have an independent safety program and has not demonstrated the characteristics of a learning organization,” the Columbia Accident Investigation Board said in its report.

Even though the causes of the two space shuttle accidents were different -- Challenger had an O-ring failure, whereas a piece of foam insulation damaged Columbia’s heat-shielding system at launch and later caused the craft to break up upon reentry -- the board found “echoes” linking the two incidents.

“The history of engineering decisions on foam and O-ring incidents had identical trajectories that ‘normalized’ these anomalies, so that flying with these flaws became routine and acceptable,” the board wrote. “Despite all the post-Challenger changes at NASA and the agencyʼs notable achievements since, the causes of the institutional failure responsible for Challenger have not been fixed.”