Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
S
Seminar-HFO
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Shashank Suhas
Seminar-HFO
Commits
439cc197
Commit
439cc197
authored
Aug 06, 2017
by
drallensmith
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Exploration of offense actions
parent
687ff761
Changes
3
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
1312 additions
and
16 deletions
+1312
-16
example/explore_offense_actions_fullstate.py
example/explore_offense_actions_fullstate.py
+1259
-0
example/hand_coded_defense_agent.py
example/hand_coded_defense_agent.py
+1
-1
hfo/hfo.py
hfo/hfo.py
+52
-15
No files found.
example/explore_offense_actions_fullstate.py
0 → 100755
View file @
439cc197
This diff is collapsed.
Click to expand it.
example/hand_coded_defense_agent.py
View file @
439cc197
...
@@ -19,7 +19,7 @@ except ImportError:
...
@@ -19,7 +19,7 @@ except ImportError:
' run:
\"
pip install .
\"
'
)
' run:
\"
pip install .
\"
'
)
exit
()
exit
()
GOAL_POS_X
=
1.0
GOAL_POS_X
=
0.9
GOAL_POS_Y
=
0.0
GOAL_POS_Y
=
0.0
# below - from hand_coded_defense_agent.cpp except LOW_KICK_DIST
# below - from hand_coded_defense_agent.cpp except LOW_KICK_DIST
...
...
hfo/hfo.py
View file @
439cc197
...
@@ -6,11 +6,12 @@ import os
...
@@ -6,11 +6,12 @@ import os
hfo_lib
=
cdll
.
LoadLibrary
(
os
.
path
.
join
(
os
.
path
.
dirname
(
__file__
),
hfo_lib
=
cdll
.
LoadLibrary
(
os
.
path
.
join
(
os
.
path
.
dirname
(
__file__
),
'libhfo_c.so'
))
'libhfo_c.so'
))
''' Possible feature sets '''
"""Possible feature sets"""
NUM_FEATURE_SETS
=
2
NUM_FEATURE_SETS
=
2
LOW_LEVEL_FEATURE_SET
,
HIGH_LEVEL_FEATURE_SET
=
list
(
range
(
NUM_FEATURE_SETS
))
LOW_LEVEL_FEATURE_SET
,
HIGH_LEVEL_FEATURE_SET
=
list
(
range
(
NUM_FEATURE_SETS
))
''' An enum of the possible HFO actions
"""
An enum of the possible HFO actions, including:
[Low-Level] Dash(power, relative_direction)
[Low-Level] Dash(power, relative_direction)
[Low-Level] Turn(direction)
[Low-Level] Turn(direction)
[Low-Level] Tackle(direction)
[Low-Level] Tackle(direction)
...
@@ -25,27 +26,58 @@ LOW_LEVEL_FEATURE_SET, HIGH_LEVEL_FEATURE_SET = list(range(NUM_FEATURE_SETS))
...
@@ -25,27 +26,58 @@ LOW_LEVEL_FEATURE_SET, HIGH_LEVEL_FEATURE_SET = list(range(NUM_FEATURE_SETS))
[High-Level] Dribble(): Offensive dribble
[High-Level] Dribble(): Offensive dribble
[High-Level] Catch(): Catch the ball (Goalie Only)
[High-Level] Catch(): Catch the ball (Goalie Only)
NOOP(): Do Nothing
NOOP(): Do Nothing
QUIT(): Quit the game '''
QUIT(): Quit the game
"""
NUM_HFO_ACTIONS
=
19
NUM_HFO_ACTIONS
=
19
DASH
,
TURN
,
TACKLE
,
KICK
,
KICK_TO
,
MOVE_TO
,
DRIBBLE_TO
,
INTERCEPT
,
\
DASH
,
TURN
,
TACKLE
,
KICK
,
KICK_TO
,
MOVE_TO
,
DRIBBLE_TO
,
INTERCEPT
,
MOVE
,
SHOOT
,
PASS
,
DRIBBLE
,
CATCH
,
NOOP
,
QUIT
,
REDUCE_ANGLE_TO_GOAL
,
MARK_PLAYER
,
DEFEND_GOAL
,
GO_TO_BALL
=
list
(
range
(
NUM_HFO_ACTIONS
))
MOVE
,
SHOOT
,
PASS
,
DRIBBLE
,
CATCH
,
NOOP
,
QUIT
,
REDUCE_ANGLE_TO_GOAL
,
MARK_PLAYER
,
DEFEND_GOAL
,
GO_TO_BALL
=
list
(
range
(
NUM_HFO_ACTIONS
))
ACTION_STRINGS
=
{
DASH
:
"Dash"
,
ACTION_STRINGS
=
[
"Dash"
,
"Turn"
,
"Tackle"
,
"Kick"
,
"KickTo"
,
"MoveTo"
,
"DribbleTo"
,
"Intercept"
,
"Move"
,
"Shoot"
,
"Pass"
,
"Dribble"
,
"Catch"
,
"No-op"
,
"Quit"
,
"Reduce_Angle_To_Goal"
,
"Mark_Player"
,
"Defend_Goal"
,
"Go_To_Ball"
]
TURN
:
"Turn"
,
TACKLE
:
"Tackle"
,
''' Possible game status
KICK
:
"Kick"
,
KICK_TO
:
"KickTo"
,
MOVE_TO
:
"MoveTo"
,
DRIBBLE_TO
:
"DribbleTo"
,
INTERCEPT
:
"Intercept"
,
MOVE
:
"Move"
,
SHOOT
:
"Shoot"
,
PASS
:
"Pass"
,
DRIBBLE
:
"Dribble"
,
CATCH
:
"Catch"
,
NOOP
:
"No-op"
,
QUIT
:
"Quit"
,
REDUCE_ANGLE_TO_GOAL
:
"Reduce_Angle_To_Goal"
,
MARK_PLAYER
:
"Mark_Player"
,
DEFEND_GOAL
:
"Defend_Goal"
,
GO_TO_BALL
:
"Go_To_Ball"
}
"""
Possible game statuses:
[IN_GAME] Game is currently active
[IN_GAME] Game is currently active
[GOAL] A goal has been scored by the offense
[GOAL] A goal has been scored by the offense
[CAPTURED_BY_DEFENSE] The defense has captured the ball
[CAPTURED_BY_DEFENSE] The defense has captured the ball
[OUT_OF_BOUNDS] Ball has gone out of bounds
[OUT_OF_BOUNDS] Ball has gone out of bounds
[OUT_OF_TIME] Trial has ended due to time limit
[OUT_OF_TIME] Trial has ended due to time limit
[SERVER_DOWN] Server is not alive
[SERVER_DOWN] Server is not alive
'''
"""
NUM_GAME_STATUS_STATES
=
6
NUM_GAME_STATUS_STATES
=
6
IN_GAME
,
GOAL
,
CAPTURED_BY_DEFENSE
,
OUT_OF_BOUNDS
,
OUT_OF_TIME
,
SERVER_DOWN
=
list
(
range
(
NUM_GAME_STATUS_STATES
))
IN_GAME
,
GOAL
,
CAPTURED_BY_DEFENSE
,
OUT_OF_BOUNDS
,
OUT_OF_TIME
,
SERVER_DOWN
=
list
(
range
(
NUM_GAME_STATUS_STATES
))
STATUS_STRINGS
=
[
"InGame"
,
"Goal"
,
"CapturedByDefense"
,
"OutOfBounds"
,
"OutOfTime"
,
"ServerDown"
]
STATUS_STRINGS
=
{
IN_GAME
:
"InGame"
,
GOAL
:
"Goal"
,
''' Possible sides '''
CAPTURED_BY_DEFENSE
:
"CapturedByDefense"
,
OUT_OF_BOUNDS
:
"OutOfBounds"
,
OUT_OF_TIME
:
"OutOfTime"
,
SERVER_DOWN
:
"ServerDown"
}
"""Possible sides."""
RIGHT
,
NEUTRAL
,
LEFT
=
list
(
range
(
-
1
,
2
))
RIGHT
,
NEUTRAL
,
LEFT
=
list
(
range
(
-
1
,
2
))
"""Possible action result statuses."""
ACTION_STATUS_UNKNOWN
,
ACTION_STATUS_BAD
,
ACTION_STATUS_MAYBE
=
list
(
range
(
-
1
,
2
))
ACTION_STATUS_MAYBE_OK
=
ACTION_STATUS_MAYBE
# typos
ACTION_STATUS_STRINGS
=
{
ACTION_STATUS_UNKNOWN
:
"Unknown"
,
ACTION_STATUS_BAD
:
"Bad"
,
ACTION_STATUS_MAYBE
:
"MaybeOK"
}
class
Player
(
Structure
):
pass
class
Player
(
Structure
):
pass
Player
.
_fields_
=
[
Player
.
_fields_
=
[
(
'side'
,
c_int
),
(
'side'
,
c_int
),
...
@@ -170,8 +202,13 @@ class HFOEnvironment(object):
...
@@ -170,8 +202,13 @@ class HFOEnvironment(object):
def
getLastActionStatus
(
self
,
last_action
):
def
getLastActionStatus
(
self
,
last_action
):
"""
"""
If last_action is the last action with a recorded status,
If last_action is the last action with a recorded status,
returns a 1 for possible success, 0 for no possibility of success,
returns ACTION_STATUS_MAYBE for possible success,
or -1 if unknown. If it is not the last action with a
ACTION_STATUS_BAD for no possibility of success,
recorded status, returns a -1.
or ACTION_STATUS_UNKNOWN if unknown. If it is not the
last action with a recorded status, returns ACTION_STATUS_UNKNOWN.
"""
"""
return
hfo_lib
.
getLastActionStatus
(
self
.
obj
,
last_action
)
return
hfo_lib
.
getLastActionStatus
(
self
.
obj
,
last_action
)
def
actionStatusToString
(
self
,
status
):
"""Returns a string representation of an action status."""
return
ACTION_STATUS_STRINGS
[
status
]
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment