From 10b49a64115ab308427261c7c2d91b2725eee8e2 Mon Sep 17 00:00:00 2001 From: Erik Nygren <erik.nygren@sbb.ch> Date: Tue, 9 Jul 2019 13:28:20 -0400 Subject: [PATCH] added initial file for observations and actions --- docs/observation_actions.rst | 30 ++++++++++++++++++++++++++++++ examples/custom_railmap_example.py | 6 ++++-- 2 files changed, 34 insertions(+), 2 deletions(-) create mode 100644 docs/observation_actions.rst diff --git a/docs/observation_actions.rst b/docs/observation_actions.rst new file mode 100644 index 0000000..6e49892 --- /dev/null +++ b/docs/observation_actions.rst @@ -0,0 +1,30 @@ +============================= +Observation and Action Spaces +============================= +This is an introduction to the three standard observations and the action space of **Flatland**. + +Action Space +============ +Flatland is a railway simulation. Thus the actions of an agent are strongly limited to the railway network. This means that in many cases not all actions are valid. +The possible actions of an agent are + +- 0 **Do Nothing**: If the agent is moving it continues moving, if it is stopped it stays stopped +- 1 **Deviate Left**: If the agent is at a switch with a transition to its left, the agent will chose th eleft path. Otherwise the action has no effect. If the agent is stopped, this action will start agent movement again if allowed by the transitions. +- 2 **Go Forward**: This action will start the agent when stopped. This will move the agent forward and chose the go straight direction at switches. +- 3 **Deviate Right**: Exactly the same as deviate left but for right turns. +- 4 **Stop**: This action causes the agent to stop. + +Observation Spaces +================== +In the **Flatland** environment we have included three basic observations to get started. The figure below illustrates the observation range of the different basic observation: Global, Local Grid and Local Tree. +.. image:: WGfFtP7.png + :target: https://i.imgur.com/ + +Global Observation +------------------ + +Local Grid Observation +---------------------- + +Tree Observation +---------------- diff --git a/examples/custom_railmap_example.py b/examples/custom_railmap_example.py index 9ccef3f..6dc157f 100644 --- a/examples/custom_railmap_example.py +++ b/examples/custom_railmap_example.py @@ -17,11 +17,13 @@ def custom_rail_generator(): grid_map = GridTransitionMap(width=width, height=height, transitions=rail_trans) rail_array = grid_map.grid rail_array.fill(0) - + new_tran = rail_trans.set_transition(1,1,1,1) + print(new_tran) agents_positions = [] agents_direction = [] agents_target = [] - + rail_array[0, 0] = new_tran + rail_array[0, 1] = new_tran return grid_map, agents_positions, agents_direction, agents_target return generator -- GitLab