From ef0aa16b04d5c1960dc307740a141a01231ab2df Mon Sep 17 00:00:00 2001 From: Thibault Neveu Date: Wed, 27 Jun 2018 16:36:24 +0100 Subject: [PATCH] Update README.md --- README.md | 33 ++++++++++++++++++++++++++++++--- 1 file changed, 30 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 56f0869..d22bbc4 100644 --- a/README.md +++ b/README.md @@ -43,7 +43,7 @@ You can use Metacar with a direct link in your HTML file or install it from NPM. - + ``` @@ -168,7 +168,16 @@ env.load().then(() => { During the training, the environment is not rendering on the screen anymore. Once your training is finish you have to notify the environment by calling env.render(true) to render the environment again.
-The state of the environment is the value of each lidar point. +The state of the environment is made of four fields: + +``` +{ + a: number|undefined // Acceleration of the car (if any) + lidar: number[][] // Lidar points values + linear: number[] // The flatten lidar values + the current speed of the car + steering: number|undefined // Steering angle of the car (if any) +} +``` Here is an example of simple training loop. @@ -189,7 +198,7 @@ env.load().then(() => { }); ``` -### Reset env +### Reset and shuffle env To reset the environment, you can either call @@ -209,6 +218,24 @@ env.load().then(() => { }); ``` +You can also shuffle the position of vehicles (agent and other cars) on the map. + + +```javascript +env.load().then(() => { + + env.addEvent("Shuffle only the agent", () => { + env.shuffle({cars: false}); + }); + + env.addEvent("Shuffle all", () => { + env.shuffle(); + }); + +}); +``` + + Custom the environement ------------