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
63c3fb68
You need to sign in or sign up before continuing.
Commit
63c3fb68
authored
Jan 27, 2016
by
sanmit
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
More minor edits
parent
424e5005
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
7 additions
and
7 deletions
+7
-7
example/hfo_example_agent.py
example/hfo_example_agent.py
+1
-1
src/agent.cpp
src/agent.cpp
+6
-6
No files found.
example/hfo_example_agent.py
View file @
63c3fb68
...
@@ -19,7 +19,7 @@ if __name__ == '__main__':
...
@@ -19,7 +19,7 @@ if __name__ == '__main__':
# Connect to the agent server on port 6000 with the specified
# Connect to the agent server on port 6000 with the specified
# feature set. See feature sets in hfo.py/hfo.hpp.
# feature set. See feature sets in hfo.py/hfo.hpp.
hfo
.
connectToAgentServer
(
port
,
HFO_Features
.
HIGH_LEVEL_FEATURE_SET
)
hfo
.
connectToAgentServer
(
port
,
HFO_Features
.
HIGH_LEVEL_FEATURE_SET
)
# Play
5
episodes
# Play
100
episodes
for
episode
in
xrange
(
100
):
for
episode
in
xrange
(
100
):
status
=
HFO_Status
.
IN_GAME
status
=
HFO_Status
.
IN_GAME
while
status
==
HFO_Status
.
IN_GAME
:
while
status
==
HFO_Status
.
IN_GAME
:
...
...
src/agent.cpp
View file @
63c3fb68
...
@@ -369,17 +369,17 @@ std::vector<int> Agent::getGameStatus(const rcsc::AudioSensor& audio_sensor,
...
@@ -369,17 +369,17 @@ std::vector<int> Agent::getGameStatus(const rcsc::AudioSensor& audio_sensor,
std
::
vector
<
int
>
status
;
std
::
vector
<
int
>
status
;
status_t
game_status
=
IN_GAME
;
status_t
game_status
=
IN_GAME
;
int
playerIndex
=
-
1
;
// Keeps track of which defender stopped the shot
int
playerIndex
=
-
1
;
// Keeps track of which defender stopped the shot
int
playerTeam
=
1
;
// 1 = offense, -1 = defense, 0 = no possession
int
playerTeam
=
hfo
::
LEFT
;
if
(
audio_sensor
.
trainerMessageTime
().
cycle
()
>
lastTrainerMessageTime
)
{
if
(
audio_sensor
.
trainerMessageTime
().
cycle
()
>
lastTrainerMessageTime
)
{
const
std
::
string
&
message
=
audio_sensor
.
trainerMessage
();
const
std
::
string
&
message
=
audio_sensor
.
trainerMessage
();
bool
recognized_message
=
true
;
bool
recognized_message
=
true
;
if
(
message
.
find
(
"GOAL"
)
!=
std
::
string
::
npos
){
if
(
message
.
find
(
"GOAL"
)
!=
std
::
string
::
npos
){
playerIndex
=
atoi
((
message
.
substr
(
message
.
find
(
"-"
)
+
1
)).
c_str
());
playerIndex
=
atoi
((
message
.
substr
(
message
.
find
(
"-"
)
+
1
)).
c_str
());
playerTeam
=
1
;
playerTeam
=
hfo
::
LEFT
;
game_status
=
GOAL
;
game_status
=
GOAL
;
}
else
if
(
message
.
find
(
"CAPTURED_BY_DEFENSE"
)
!=
std
::
string
::
npos
)
{
}
else
if
(
message
.
find
(
"CAPTURED_BY_DEFENSE"
)
!=
std
::
string
::
npos
)
{
playerIndex
=
atoi
((
message
.
substr
(
message
.
find
(
"-"
)
+
1
)).
c_str
());
playerIndex
=
atoi
((
message
.
substr
(
message
.
find
(
"-"
)
+
1
)).
c_str
());
playerTeam
=
-
1
;
playerTeam
=
hfo
::
RIGHT
;
game_status
=
CAPTURED_BY_DEFENSE
;
game_status
=
CAPTURED_BY_DEFENSE
;
}
else
if
(
message
.
compare
(
"OUT_OF_BOUNDS"
)
==
0
)
{
}
else
if
(
message
.
compare
(
"OUT_OF_BOUNDS"
)
==
0
)
{
game_status
=
OUT_OF_BOUNDS
;
game_status
=
OUT_OF_BOUNDS
;
...
@@ -388,13 +388,13 @@ std::vector<int> Agent::getGameStatus(const rcsc::AudioSensor& audio_sensor,
...
@@ -388,13 +388,13 @@ std::vector<int> Agent::getGameStatus(const rcsc::AudioSensor& audio_sensor,
}
else
if
(
message
.
find
(
"IN_GAME"
)
!=
std
::
string
::
npos
){
}
else
if
(
message
.
find
(
"IN_GAME"
)
!=
std
::
string
::
npos
){
switch
(
message
.
at
(
message
.
find
(
"-"
)
+
1
)){
switch
(
message
.
at
(
message
.
find
(
"-"
)
+
1
)){
case
'L'
:
case
'L'
:
playerTeam
=
1
;
playerTeam
=
hfo
::
LEFT
;
break
;
break
;
case
'R'
:
case
'R'
:
playerTeam
=
-
1
;
playerTeam
=
hfo
::
RIGHT
;
break
;
break
;
case
'U'
:
case
'U'
:
playerTeam
=
0
;
playerTeam
=
hfo
::
NEUTRAL
;
break
;
break
;
}
}
playerIndex
=
atoi
((
message
.
substr
(
message
.
find
(
"-"
)
+
2
)).
c_str
());
playerIndex
=
atoi
((
message
.
substr
(
message
.
find
(
"-"
)
+
2
)).
c_str
());
...
...
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