Welcome, Chief Software Engineer.
The Mars Exploration Program has successfully landed the Rover-X in the Jezero Crater. However, the rover's autonomous operating system was corrupted during the descent.
Your mission: Restore the core functionality of the rover using Python. You must implement the navigation, power management, and scientific sampling systems to ensure the rover survives the harsh Martian environment.
-
Python 3.x installed on your machine.
-
Git installed (for cloning the repository).
-
A code editor (VS Code, PyCharm, or IDLE).
Open your terminal or command prompt and run the following command to download the mission files to your local machine:
git clone https://github.com/LJones-alt/MarsRover.git
(Note: You can also fork this repo if you want your own version)
cd MarsRover
To test the current (broken) system, run:
python mars_rover.py
Open mars_rover_skeleton.py in your code editor. Look for the comments marked # TODO. You need to implement the following systems:
-
Set the starting coordinates x and y to 0.
-
Set the battery level to 100.
-
Initialize an empty list for samples.
-
Power Check: Ensure the rover has battery (> 0) before moving.
-
Coordinate Updates:
-
'w' (North): Increase Y
-
's' (South): Decrease Y
-
'd' (East): Increase X
-
'a' (West): Decrease X
-
-
Power Consumption: Every move costs 5% battery.
-
Add the sample type (e.g., "Rock", "Dust") to the samples list.
-
Print a confirmation message.
-
Print the current position (x, y).
-
Print the remaining battery charge.
-
Print the inventory of collected samples.
- Connect your functions to the main while loop at the bottom of the file so user commands trigger the correct actions.
Once your code is running, you can control the rover using the following inputs in the terminal:
CommandAction
w, a, s, d
Move North, West, South, or East
scan
Display status report (Position, Battery, Samples)
dig
Collect a geological sample
exit
Terminate mission and close program
-
Battery Management: If your battery hits 0, the rover should stop moving.
-
Map Logic: Remember that (0,0) is your landing site.
-
Moving North (w) makes Y positive.
-
Moving South (s) makes Y negative.
-
-
Testing: Test frequently! Run the code after implementing each function to make sure it works.
Good luck, Engineer. The Red Planet awaits.