What is the code in Roscosmos

What languages are spoken in Roscosmos, NASA and SpaceX

On August 11, Roscosmos plans to launch a new module — Luna-25. He will collect soil samples, study the exosphere and the south pole of the satellite, and help find out if there is water on the Moon and in what quantity.

We decided that this was an occasion to understand and tell in which programming languages software for spacecraft is written and which solutions are used by Roscosmos, NASA and SpaceX.

What is the code in Roscosmos

Roscosmos uses a special programming language — DRAGON, which was invented back in the Soviet Union.

This is a visual YAP that helps to create scripts based on algorithms. The name stands for Friendly Russian Algorithmic Language, Which Provides Visibility.

The DRAGON is based on the programming languages PROL2, DIPOLE and LAX, which were used in the 70s. PROL2 is designed for the development of on—board programs, DIPOLE — for ground test programs, and LAX – for modeling.

Dragon developers came up with a kind of no-code system that made the work of programmers easier and accelerated development.

What is the code in Roscosmos

At the same time, DRAGON is not an independent programming language. It is rather a program for creating flowcharts. DRAGON supports JavaScript, Python or C++, together with which it forms hybrid languages like DRAGON-Python.

The blocks contain the code to be executed by the program. Only functions are written in them, and keywords like if, else, switch, case, for or while are indicated by means of the scheme. After that, the flowchart is converted into a text code.

It seems that the DRAGON complicates the task: it is easier to write code than to draw diagrams and program at the same time. But the language is used for complex spacecraft control systems, and the code can have a lot of nested functions with a billion if. In this case, it is easier to understand the code when it is clearly presented in the form of a diagram.

You might also think that the DRAGON is an outdated development that cannot be used for 60 years, when neural networks have already come into the world.

This is not so: the language is still used in software for control systems of launch vehicles and upper stages of spacecraft. Among them:

  • DM-SL spacecraft upper stage (within the framework of the international project “Sea Launch” — participants Russia, USA, Ukraine, Norway);
  • Fregat spacecraft upper stage (Russian-European project);
  • upgraded Proton-M heavy class launch vehicle;
  • upper stage of DM-03 spacecraft;
  • the upper stage of the spacecraft “Ground launch”;
  • Angara 1,2 light class launch vehicle;
  • The Angara-A5 heavy class launch vehicle.

What does NASA code on

Back in the 2000s, the code for NASA spacecraft was written in Assembler. All because the ships used low-power processors by modern standards. For example, in 2006, the ships were powered by Intel 8085 processors manufactured in 1976.

They tried to abandon the Assembler: Back in the 1970s, NASA tried to develop a special programming language HAL. HAL had two subspecies: HAL/S for spaceships and HAL/G for the control center.

HAL was cleaned up as much as possible from designs that could cause software errors, so that a no-frills tool turned out that would not let astronauts down.

Despite its simplicity and reliability, HAL languages were inconvenient in terms of syntax, which is why HAL/S was abandoned, and HAL/G was not developed at all.

Here’s what the entry z = y^2 +x*hi looked like

By 1980, the Ada language was developed for the US Department of Defense. It was a universal language used to control ships, planes and military bases. It was decided to use it at NASA.

Initially, Ada was similar to the Algol and Pascal languages and was distinguished by strict typing. Later, he began to support the principles of OOP, and the last major update for Ada was released in 2012. Also, the Ada code was 60% cheaper than in C, and produced 9 times fewer errors.

Here is a sample code on Ada:

with Ada.Text_IO;

procedure Hello is
use Ada.Text_IO;
Put_Line(“Hello, world!”);
end Hello;

An attentive reader will ask the question: “Why is it more profitable to use Ada if Hello World occupies 7 lines?”. Well, this reader will be absolutely right! The exact same question was asked by the US Department of Defense and NASA.

Although the Ada code was simple, fast and reliable, it was not easy, which is why NASA switched to C.

Today, most of the software at NASA is developed in C, and Python is not used at all. Also, NASA developers try not to use C++. The reason is that the C++ code is difficult to maintain, and errors often occur in the code.

When developing in C, problems arise less often, because it is closest to the level of “hardware”, and writing in it is easy and fast.

Also, oddly enough, NASA engineers do not use resource-intensive hardware and prefer chips with a frequency of 20 MHz and 128 MB RAM. It is impossible to load such hardware with complex scripts: you have to save on everything.

What is the code in SpaceX

Unlike NASA, SpaceX — Elon Musk’s company, which was founded to colonize Mars — uses C++, which is ideal for developing remote control systems.

It can be assumed that Musk’s private company can afford to use modern hardware, for which running programs in C++ is not a problem.

SpaceX also uses JavaScript: in particular, the Knockout web application framework.js and the Handlebars

template engine.

A little less often, the company uses the LESS and Python dynamic style language. As for operating systems, SpaceX is implementing Linux.

Ready-made software for a flight to the Moon

Unfortunately, astronauts do not share software configurations for launching rockets, but there are scraps of information about which solutions were used earlier.

On GitHub, you can find several repositories with the code for the Apollo 11 mission – the one during which the Americans were the first to land on the moon. Or which was allegedly filmed by Stanley Kubrick in one of the Hollywood studios.

Here are some repositories with restored software for Apollo-11:

  • chrislgarry/Apollo-11 is the most popular repository with Assembler code. The software was restored by specialists from VirtualAGC and the MIT Museum. This is exactly what the code for the original lunar mission looked like.
  • alfonsokim/apollo-guidance-computer — SOFTWARE for the Decision-making Center of the Apollo 11 mission. The main part of the code is written in C and C++ languages. It will be much easier to understand the code than in Assembler.
  • virtualagc/virtualagc is another version of the software for the Decision Center. Most of it is written in Assembler. Xproc and C are also used .

In addition, the OS that was used in NASA and SpaceX is known. This is VxWorks, a UNIX system that has become the main one for Dragon series ships. VxWorks was also used for the Curiosity rover, which was launched in 2011.

Back in 2021, NASA published a list of open-source solutions used in the program. Here you can find, for example, software for the Astrobee robot, which performs docking and landing on the ISS.

I hope, after reading this article, you are eager to write your own software for a spaceship, and in the future you will find the fate of Elon Musk with his own SpaceX analogue. In that case, don’t forget to mention Tproger in the ceremonial speech when your module successfully lands on the moon! 🙂

And if you are already a kind of Elon Musk or just an experienced software developer for spacecraft, share your insiders in the comments: tell us what programming languages you use, what technologies should be considered by novice space developers and how to successfully launch a rocket into space.

0 0 votes
Article Rating
Notify of

Inline Feedbacks
View all comments