瀏覽代碼

Update the README

Include usage examples.
Oz N Tiram 4 年之前
父節點
當前提交
a5aebb35bc
共有 1 個文件被更改,包括 28 次插入12 次删除
  1. 28 12
      README.md

+ 28 - 12
README.md

@@ -12,8 +12,8 @@ The requirements to run this code are:
  * GNU Make (optional)
 
 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)
@@ -28,19 +28,35 @@ If you have GNU Make installed on your system you can simply use:
 $ make setup/dev
 $ 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.