3rd Jun 2021 8 minutes read Python on Mars: How Programmers Conquered the Red Planet Jakub Romanowski python basics learn python “Space, the final frontier …” This is how each episode of the iconic Star Trek series began. I’m a huge fan, but what happened in space recently was as interesting as the adventures of the Starship Enterprise crew. Moreover, Python, as one of the programming languages used by NASA, played a significant role in this. I’ve been interested in space exploration for years. I follow world media reports on the success of space probes, rovers, and landers. Because I also love Python, I began to notice its significant contribution to the development of space programs. Thanks to the language created by Guido van Rossum, a lot has been achieved. Here are just some of the milestones that Python has helped with. What Happened on Mars? If you’re interested in space exploration, you’re probably familiar with NASA (National Aeronautics and Space Administration), which has been operating continuously since 1958. It is an independent agency reporting directly to the President of the United States. It’s been one of the most important space exploration organizations, uniting scientists and engineers in various fields. In addition to the space flight program, NASA is also responsible for the long-term space research program and climate change monitoring. The goal of NASA’s Mars 2020 project is to search for environments capable of supporting biological life, identify traces of potential Martian life, and perform geological and meteorological research. All of this is in order to be able to send scientists and astronauts to the Red Planet in the future to start the possible colonization of Mars. What used to be just the subject of science fiction books and movies is now becoming more and more real. The Atlas V rocket with the Perseverance Mars rover on board launched from Cape Canaveral on July 30, 2020. It had a distance of over 470 million kilometers to cover. The probe was to land on Mars, at the bottom of the Jezero Crater. It succeeded as planned on February 18, 2021. Four minutes after landing, the rover sent the first images of the surface of Mars to Earth. But what does this have to do with Python? Well, as it turns out, this programming language played a large part in the mission. The moment of landing itself was recorded by 5 cameras placed in different parts of the probe. Python scripts were used to process the images and transfer them to the flight control center. Thanks to this, scientists (and everyone else, via the Internet) had a chance to look at the surface of Mars like never before. The recording went down in space program history and once again confirmed that humans are capable of achieving the impossible. Fun Fact: A large part of the rover's hardware and components works on open-source software. The video recordings were made by a CPU operated by a Linux distribution. Perseverance isn't the only mission to Mars right now. China's National Space Administration (CNSA) joined the race to find traces of life there as well. Their rover landed on May 15 and has already sent its first photos. The Zhurong rover, named after the god of fire from ancient Chinese mythology, has a solar drive and six wheels. It is 1.85 meters high and weighs 240 kilograms. However, the CNSA is less willing to share technical details, so it’s not known what technology was used. Perhaps also Python? Maybe we'll find out someday. This is the next step in China's space program. In the coming years, they plan to build a research station on the moon with Russia. First Drone Flight on Another Planet The news of Perseverance's success spread through social media. Everyone was waiting impatiently for the next news. Among the voices on Twitter was the Python Software Foundation, which officially confirmed Python’s involvement in the project. Congratulations to @NASAJPL on the successful landing of the Perserverance Mars Rover.We're excited to see that Python could play a part in the flight software for the first ever Mars drone. https://t.co/R2IxiYCAjVGodspeed @NASAPersevere.https://t.co/Ih8s4INr3z— Python Software Foundation (@ThePSF) February 18, 2021 The next news was about the Ingenuity drone, which since APRIL 19 has already made five flights on Mars. The robotic helicopter was supposed to complete its mission after a month, but due to its considerable successes and lack of faults, scientists decided to extend it and plan further flights. The machine is driven by F’ (FPrime) software developed by engineers from NASA's Jet Propulsion Laboratory. It has been successfully deployed on several space applications, including as helicopter controls. This C ++ based framework supports Python libraries and packages. Due to NASA's commitment to the open-source environment, a large part of the code was created in Python. Do you want to test yourself in F'? Everything you need can be found on the GitHub project profile. The framework was built for Linux, but it also works on MacOS. To use it on Windows, you’ll need to run a Linux distro on a virtual machine. Ok, back to the Ingenuity drone. Its first two flights were vertical; the drone just went up and down. The third attempt on April 26 was a level flight – Ingenuity flew for 80 seconds and accelerated to 2 meters per second (about 4.5 mph / 7.2 kph). During subsequent attempts, it flew even further. On the fifth flight, Ingenuity flew 266 meters at 5 meters above the surface of Mars, which took 2 minutes. Although this does not seem like much, it is a huge leap for the development of technology. For the first time in history, man has flown on another planet. All flight code developers can confidently call themselves star pilots. I must admit that I envy them very much. How the Open-Source Community Helped with Ingenuity The fact that people managed to break technological barriers and successfully fly a drone on another planet is not the feat of NASA engineers alone. A huge and invaluable contribution to the project was made by a crowd of developers in the GitHub community. Most of them did not even realize that they were helping conquer Mars. They only found out about it one morning, when this badge appeared on their profiles: This badge was awarded to the GitHub contributors who worked on specific versions of the projects and libraries used by NASA’s Jet Propulsion Laboratory to put Ingenuity into flight. Nearly 12,000 open-source developers around the world contributed and were honored for that. From now on, they can boast to everyone that they did something amazing. You can view the full list of projects used by NASA for Ingenuity here – and there are about 60 of them, including Python, SciPy, NumPy, Matplotlib, OpenCV, Elasticsearch, and F ' (FPrime). Interestingly, to control such a huge project and the effect of the work of thousands of developers ... they used Python. The Six library played a significant role in this. “The language is used for all sorts of things I never would have imagined,” admitted library creator Benjamin Peterson in an interview. There are tons of open-source projects on the NASA website that call for Python skills. If you are into stars and spaceships like me, you might try to take part in one of these challenges. Over time, you may also contribute to the conquest of the universe! What Programming Languages Does NASA Use? Many of the things we use were originally created in NASA laboratories. It is enough to mention scratch-resistant glass, smartphone lenses, or airtight zippers (which first appeared in pressure suits and now are used in scuba diving and hazmat suits). NASA is involved in thousands of projects. Therefore, it cannot be said that a particular programming language is their main choice. There are also no official statistics. However, looking at the works and achievements to date, some dominant languages can be observed. So what is NASA using? MATLAB – mainly for engineering analysis. C and C ++ Python – for analysis, data science, GUIs, and open-source projects. Other languages – such as Fortran, Node.js, and Visual Basic – are used to a lesser extent. Would you like to be part of the team? It’s possible. NASA publishes a list of current job openings on its website. At the time of writing this article, an advertisement for the position of Management and Program Analyst at the agency's headquarters was active. If you know Python, R, and learn machine learning, you can earn over $150,000 a year. Pretty good! How To Learn Python You must first learn the basics before you start coding a Martian lander. Start with LearnSQL’s Python Basics track. This is something for people without any background in IT, who have never written a line of code in their lives. If you want, you can also jump into deeper water and learn with our flagship Learn Programming with Python track. What will you find inside? Everything you will need to start your adventure with Python. Our track includes: Python Basics – These three courses make up the Python Basics track mentioned above. You’ll learn the basic commands and functions of this language and start thinking like a programmer. These courses cover foundational concepts like variables, loops, and conditional statements. Python Data Structures in Practice – Learn to use common Python data structures and write a real Python game! Built-in Algorithms in Python – Learn Python’s built-in algorithms and functions and write optimized applications in a shorter amount of time. If you are interested in which other global companies use Python and why, check out this article. Spoiler alert: the list includes Uber and Netflix. If you're still lacking inspiration, check out my friend Soner's article on How to Start Your Adventure With Programming. Or there’s Marcin's article if you are worried that you are too old for a career in IT. Find out the main reasons why you should learn Python this year. Make your job easier and earn more. Start learning today! Tags: python basics learn python