Mars Rover Navigation
Summary
This program is part of the software that runs on board a hypothetical Mars planetary rover. The rover will perform daily exploration and science activities on the surface of Mars. The purpose of this program is to check the provided instructions and determine whether a path is possible to specific points of interest.
Context
This was completed as a university coding assignment for MTRX1702. The assignment was coded in the C programming language.
The maps are 128x128 pixels, where each pixel represents 1 square meter of land. Each pixel has a height in meters (ranging from 0 to 7) and a terrain type (ranging from 0 to 3). They are represented in a large binary file, where each cell is 1 byte of data, with the height, terrain type and some other information.
2 rules govern the rover’s movement. Firstly, the rover can’t traverse over type 3 terrain or where the slope is greater than 1.5 m/m, i.e. the height difference between adjacent cells is greater than 1.5 m.
First, we scan the data and check for errors in any pixels, then correct them by using the pixels around the corrupted one. Once that was completed, we loaded the fixed map, ready to use.
The program has 3 modes: query mode, path check mode and pathfinding mode.
Query mode is simple; it returns information about a pixel (height, terrain type, whether it’s a science goal and whether the rover is currently there).
Path check mode is used to see if a specified path is possible for the rover to traverse. Commands are provided line-by-line with actions (forward, backwards, turn left/right) and quantity (distance to move or angle to turn). At the end, the program tells the user if the provided instructions are possible to execute, and if so, how many units of energy the path would consume.
Finally, pathfinding mode is used to check if there is a feasible path from the rover’s position to a specified science goal. We didn't have to find the most optimal path, just whether or not the goal could be reached.