Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Flatland
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Flatland
Flatland
Commits
0b18e5ed
Commit
0b18e5ed
authored
5 years ago
by
Erik Nygren
Browse files
Options
Downloads
Patches
Plain Diff
this adresses isse #264.
Fixed how we handle agents off the grid with the observation example
parent
49bda6d3
No related branches found
Branches containing commit
No related tags found
Tags containing commit
2 merge requests
!251
264 fixed examples branch 2
,
!249
264 fixing examples
Pipeline
#2626
passed
5 years ago
Stage: tests
Stage: integration_testing
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
examples/custom_observation_example_02_SingleAgentNavigationObs.py
+4
-1
4 additions, 1 deletion
...custom_observation_example_02_SingleAgentNavigationObs.py
with
4 additions
and
1 deletion
examples/custom_observation_example_02_SingleAgentNavigationObs.py
+
4
−
1
View file @
0b18e5ed
...
...
@@ -34,8 +34,11 @@ class SingleAgentNavigationObs(ObservationBuilder):
def
get
(
self
,
handle
:
int
=
0
)
->
List
[
int
]:
agent
=
self
.
env
.
agents
[
handle
]
if
agent
.
position
:
possible_transitions
=
self
.
env
.
rail
.
get_transitions
(
*
agent
.
position
,
agent
.
direction
)
else
:
possible_transitions
=
self
.
env
.
rail
.
get_transitions
(
*
agent
.
initial_position
,
agent
.
direction
)
possible_transitions
=
self
.
env
.
rail
.
get_transitions
(
*
agent
.
position
,
agent
.
direction
)
num_transitions
=
np
.
count_nonzero
(
possible_transitions
)
# Start from the current orientation, and see which transitions are available;
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment