Page 1 of 2

7 Minutes of Terror with 500.000 lines of Code.

Posted: Fri Aug 03, 2012 2:11 pm
by codewalker
Hi,

On the 6th of August, monday morning (or sunday night in america)
a Nasa vehicle will land on Mars. It has the size of about a mini-cooper.
It took 10 years of Engineering and 2,5 billion dollars. The vehicle is powered by a plutonium battery.
It has the most sophisticated lab and tools on board to diagnose the surface of Mars.

The landing goes in 4 stages: 1.heat shield 2.parachute 3. rocket shell 4.crane cables.
The landing will take about 7 minutes and is the most crucial part of the whole mission.
That's why it is called 7 Minutes of Terror !
The landing is controlled by onboard computers with about 500.000 lines of code !

Here's a good video to get an impression:

http://abcnews.go.com/Technology/minute ... BvE41IcbEg

Does anyone have an idea what program language(s) Nasa is using for such missions ?
I guess it will be lower level languages like c or assembly ?

I really hope the landing will go successfully.

Greetings
cw

Re: 7 Minutes of Terror with 500.000 lines of Code.

Posted: Fri Aug 03, 2012 3:02 pm
by spikey
C++ would be my guess as Curiosity is based upon a real time OS called vxWorks.

Re: 7 Minutes of Terror with 500.000 lines of Code.

Posted: Fri Aug 03, 2012 3:38 pm
by Foz
Radiation hardened PowerPC chips, so it's probably running an out of date copy of OSX, and using Java... :mrgreen:

No App Store for the Martians!

Re: 7 Minutes of Terror with 500.000 lines of Code.

Posted: Fri Aug 03, 2012 4:35 pm
by xorc1zt
hard to tell but the kernel is probably made with c or ada and the remote agent with java.
years ago they used common lisp : http://www.flownet.com/gat/jpl-lisp.html (look at "1994-2000 - Remote Agent")

Re: 7 Minutes of Terror with 500.000 lines of Code.

Posted: Fri Aug 03, 2012 4:57 pm
by luis
As spikey said AFAIK they use vxWorks and C (at least in some past missions, don't know about this one).
Probably part of the reason is the hw is quite limited compared to the everyday PC.
http://en.wikipedia.org/wiki/Comparison ... ars_rovers

Re: 7 Minutes of Terror with 500.000 lines of Code.

Posted: Fri Aug 03, 2012 4:58 pm
by srod
What, no .NET; I'm disgusted!

:D

Re: 7 Minutes of Terror with 500.000 lines of Code.

Posted: Fri Aug 03, 2012 5:55 pm
by eesau
I heard from a reliable source that they are in fact using Brainfuck.

Re: 7 Minutes of Terror with 500.000 lines of Code.

Posted: Fri Aug 03, 2012 6:13 pm
by xorc1zt
eesau wrote:I heard from a reliable source that they are in fact using Brainfuck.
they should adopt malbolge

nasa open source: http://code.nasa.gov/

Re: 7 Minutes of Terror with 500.000 lines of Code.

Posted: Fri Aug 03, 2012 7:27 pm
by Thorium
I guess the code isnt that big because it's very low level. I think it's that big because they put in code to handle any possible situation they could think of that could happen on the landing process.

Re: 7 Minutes of Terror with 500.000 lines of Code.

Posted: Fri Aug 03, 2012 7:43 pm
by luis
Some answers from NASA people about the pathfinder mission (it's old but still relevant I think):

QUESTION:
What type of computer is the Pathfinder utilizing? Is the CPU from Intel or
Motorola or custom made? How fast does it run and how much memory does it
contain? Is there more than one computer on board? What programming language
was utilized in the software?

ANSWER from Bridget Landry on April 28, 1997:
The rover code is written in C and assembly language. This code implements
a custom command set tailored to the specific hardware/software
capabilities of the rover.

ANSWER from Lloyd Keith:
The computer is a Radiation Hardened IBM Risc 6000 Single Chip (Rad6000 SC)
CPU. It is the same as the IBM R6000 workstation. Lockeed-Martin Federal
Systems in Manassas, VA, is responsible for doing the radiation hardening of
the Rad6000 SC as well as developing the complete Mars Pathfinder Flight
Computer (MFC).

The MFC contains 128 MBytes of DRAM memory and runs at speeds of 2.5, 5, 10
and 20 MegaHertz. This translates to approximately 2.7, 5.5, 11, and 22 MIPS
(this does vary, depending on which benchmark is being used). The code was
developed using VxWorks as the real-time OS and "C" and assembly languages.
It utilizes object-oriented constructs.

On the system there is only one computer to control the spacecraft
throughout all phases of the mission. The Rover has a very small CPU that it
uses once we have landed and the rover is released. All communications to
Earth from the spacecraft and rover come through the Rad6000 SC.

--Lloyd Keith, MFC (Mars Pathfinder Flight Computer) Chief Engineer

ANSWER from Charles Whetsel on June 26, 1997:
The Mars Pathfinder Flight Software was written in the C programming
language. The computer chip is from the RS6000 family (a space-qualified
radiation-hardened derivative), which is commonly used in UNIX workstations
and was the predecessor to the PowerPC chip used in Macintosh computers.

ANSWER from Steve Stolper on July 20, 1997:
The computer on the spacecraft is a single-board, single chip, rad-hard
implementation of IBM's RS/6000 architecture. The tool-chain used is
IBM's XLC compiler.

We are flying VxWorks, from Wind River Systems, as our real-time operating
system.

QUESTION:
What specific programming tasks in Pathfinder were done in assembly, and why
why wasn't C used instead? Was the assembly used within C programs or in
separate assembly-only programs?

ANSWER from Steve Stolper on October 28, 1997:
Assembly language still has utility. The majority of the "boot" code was
written in assembly language because (very simplified):

1. Performance is VERY important. If the spacecraft were to take a reset
while plunging through the atmosphere at 17,000 MPH, it is vital that the
computer system boot up extremely quickly.

2. Assembly language is compact. A variety of technical reasons dictated
that the boot code occupy as little EEPROM as possible. These reasons
included vulnerability to corruption, desireability of redundancy, and lack
of EEPROM.

3. Assembly language is powerful. The boot process configures the flight
computer to run. This includes a lot of low-level "housekeeping" required
to place the computer into a state that can execute the flight code.

In addition, assembly code was used whenever its performance/power was
warranted. Knowledge of assembly language programming was vital for
debugging the working system. Insidious bugs demanded that the developer
understand EXACTLY what the processor was doing.

The assembly language files were kept separate from the "C" language files.
This modularity aided our development effort.

More Q&A here:
http://passporttoknowledge.com/lfm/ask/about-mars-path/

Re: 7 Minutes of Terror with 500.000 lines of Code.

Posted: Fri Aug 03, 2012 9:18 pm
by xorc1zt
they are using a c++ framework named claraty

http://www-robotics.jpl.nasa.gov/public ... e_iros.pdf
http://www-robotics.jpl.nasa.gov/public ... LARAty.pdf
C++ Language: C++ will be used to create CLARAty, due to its wide use in academia and industry, the
need for an object-oriented implementation, and the requirements of real-time software implementa-tion.

OS support: To provide both real-time software support while allowing for workstation development,
CLARAty will be constructed to run under VxWorks, Linux, and Solaris. Extension to other op-erating systems in the future is possible.
source goes open but the site seem down: http://www-robotics.jpl.nasa.gov/news/n ... ?NewsID=69

Re: 7 Minutes of Terror with 500.000 lines of Code.

Posted: Fri Aug 03, 2012 10:11 pm
by Zach
I guess I have unreasonable expectations, but I am rather unimpressed that it took them 500k lines of code to write management software for a space/planetary probe.

Considering what we did in the past with computers that could barely hold a candle to a pocket calculator (and in real-time I would think). I'm not expecting everything to be written in Assembly or Machine Code or anything, and I realize moving up to higher level languages and frameworks, and pre-packaged modules and such makes it a lot easier to code and all that, but still..

500k lines of code? I wonder how much ram the thing has, if Pathfinding required 128MB in the 90's... Just doesn't seem like the level of proficiency I would expect from rocket scientists.
Seems like they might as well have just slapped an i7, 16GB of ram, and a GPU in there and called it a day.

I hope they at least did some optimizations somewhere or other..


500,000 seems like a big number to me.. I know complex programs can be several million lines, but I don't think I've seen anyone post here about a program nearing even 500k lines.

Re: 7 Minutes of Terror with 500.000 lines of Code.

Posted: Sat Aug 04, 2012 7:41 am
by IdeasVacuum
On the system there is only one computer to control the spacecraft
throughout all phases of the mission.
Achilles Heel :shock:

Re: 7 Minutes of Terror with 500.000 lines of Code.

Posted: Sat Aug 04, 2012 12:03 pm
by electrochrisso
Just think, if it were coded using PB, it would only be 50 lines of code. :)

Re: 7 Minutes of Terror with 500.000 lines of Code.

Posted: Thu Aug 09, 2012 3:33 am
by RichAlgeni
And Voyager I & II are chugging along on Zilog Z-80's.