|
@@ -12,8 +12,8 @@ The requirements to run this code are:
|
|
* GNU Make (optional)
|
|
* GNU Make (optional)
|
|
|
|
|
|
To run the code create a virtual
|
|
To run the code create a virtual
|
|
-environment and install the dependecies and then the code itself. If you are
|
|
|
|
-familiar with Python you can also use Pipenv and skip the following instructions:
|
|
|
|
|
|
+environment and install the dependencies and then the code itself. If you are
|
|
|
|
+familiar with Python you can also use pipenv and skip the following instructions:
|
|
|
|
|
|
```
|
|
```
|
|
# These istructions assume you use a shell on a UNIX like system (Mac or Linux)
|
|
# These istructions assume you use a shell on a UNIX like system (Mac or Linux)
|
|
@@ -28,19 +28,35 @@ If you have GNU Make installed on your system you can simply use:
|
|
$ make setup/dev
|
|
$ make setup/dev
|
|
$ source rover/env/activate
|
|
$ source rover/env/activate
|
|
```
|
|
```
|
|
-
|
|
|
|
-USAGE
|
|
|
|
|
|
+USAGE
|
|
-----
|
|
-----
|
|
-To land the rover on mars:
|
|
|
|
|
|
+Here is a short example how one can use the Rover class:
|
|
|
|
|
|
|
|
+1. Land at user specified location
|
|
```
|
|
```
|
|
-$ rover land
|
|
|
|
-Landed on (7, 2) Facing East.
|
|
|
|
-```
|
|
|
|
-To move the rover
|
|
|
|
-```
|
|
|
|
-$ rover move FSF
|
|
|
|
-Moved to (8, 1) Facing South.
|
|
|
|
|
|
+>>> r = Rover(x=2, y=2, heading='N')
|
|
|
|
+>>> r.move("FFF")
|
|
|
|
+Location (2, 5) Heading N
|
|
```
|
|
```
|
|
|
|
|
|
|
|
+2. Land at random location:
|
|
|
|
+```
|
|
|
|
+>>> from rover import Rover
|
|
|
|
+>>> r = Rover()
|
|
|
|
+/home/oznt/Software/mars-rover/src/rover/rover.py:20: UserWarning: Landing at a random place
|
|
|
|
+ warnings.warn("Landing at a random place")
|
|
|
|
+>>> r.location
|
|
|
|
+<rover.rover.Location object at 0x7f3dae21e160>
|
|
|
|
+>>> r.location.x
|
|
|
|
+9
|
|
|
|
+>>> r.location.y
|
|
|
|
+-8
|
|
|
|
+>>> r.location.heading
|
|
|
|
+'S'
|
|
|
|
+>>> r.location.heading = 'N'
|
|
|
|
+>>> r.move('FFF')
|
|
|
|
+Location (9, -5) Heading N
|
|
|
|
|
|
|
|
+```
|
|
|
|
+The interface is very minimal and on can only land and move the rover towards
|
|
|
|
+the north and the east.
|