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
5923ab98
Commit
5923ab98
authored
Mar 22, 2016
by
Matthew Hausknecht
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Removed unum from connectToServer function.
parent
4b702be9
Changes
20
Show whitespace changes
Inline
Side-by-side
Showing
20 changed files
with
38 additions
and
42 deletions
+38
-42
bin/Trainer.py
bin/Trainer.py
+3
-4
doc/manual.pdf
doc/manual.pdf
+0
-0
doc/manual.tex
doc/manual.tex
+2
-2
example/communication_agent.cpp
example/communication_agent.cpp
+5
-6
example/communication_agent.py
example/communication_agent.py
+1
-1
example/example_high_level_random_agent.py
example/example_high_level_random_agent.py
+1
-1
example/hfo_example_agent.cpp
example/hfo_example_agent.cpp
+2
-3
example/hfo_example_agent.py
example/hfo_example_agent.py
+1
-1
example/high_level_random_agent.cpp
example/high_level_random_agent.cpp
+1
-2
example/low_level_random_agent.cpp
example/low_level_random_agent.cpp
+1
-2
example/mid_level_dribble_agent.cpp
example/mid_level_dribble_agent.cpp
+1
-2
example/mid_level_kick_agent.cpp
example/mid_level_kick_agent.cpp
+1
-2
example/mid_level_move_agent.cpp
example/mid_level_move_agent.cpp
+1
-2
example/passing_agents.sh
example/passing_agents.sh
+2
-2
hfo/hfo.py
hfo/hfo.py
+3
-6
hfo/hfo_c_wrapper.h
hfo/hfo_c_wrapper.h
+1
-2
src/HFO.cpp
src/HFO.cpp
+4
-2
src/HFO.hpp
src/HFO.hpp
+3
-2
src/agent.cpp
src/agent.cpp
+4
-0
src/agent.h
src/agent.h
+1
-0
No files found.
bin/Trainer.py
View file @
5923ab98
...
...
@@ -72,11 +72,10 @@ class Trainer(object):
'teams'
,
'base'
)
config_dir
=
os
.
path
.
join
(
binary_dir
,
'config/formations-dt'
)
print
(
"Waiting for player-controlled agent
%
s-
%
d: config_dir=
%
s, "
\
"uniform_number=
%
d, server_port=
%
d, server_addr=
%
s, team_name=
%
s, "
\
"play_goalie=
%
r"
"server_port=
%
d, server_addr=
%
s, team_name=
%
s, play_goalie=
%
r"
%
(
self
.
_offenseTeamName
if
play_offense
else
self
.
_defenseTeamName
,
agent_num
,
config_dir
,
agent_ext_num
,
self
.
_serverPort
,
"localhost"
,
team_name
,
agent_ext_num
==
1
))
agent_num
,
config_dir
,
self
.
_serverPort
,
"localhost"
,
team_name
,
agent_ext_num
==
1
))
if
wait_until_join
:
self
.
waitOnPlayer
(
agent_ext_num
,
play_offense
)
return
None
...
...
doc/manual.pdf
View file @
5923ab98
No preview for this file type
doc/manual.tex
View file @
5923ab98
...
...
@@ -106,7 +106,7 @@ to connect the offensive player:\\
\noindent
\verb
+
Waiting for player-controlled agent base_left-0:
+
\\
\noindent
\verb
+
config_dir=HFO/bin/teams/base/config/formations-dt,
+
\\
\noindent
\verb
+
uniform_number=11,
server_port=6000, server_addr=localhost,
+
\\
\noindent
\verb
+
server_port=6000, server_addr=localhost,
+
\\
\noindent
\verb
+
team_name=base_left, play_goalie=False
+
\\
By default, the server starts on port 6000, but may be changed as follows:
\\
...
...
@@ -179,7 +179,7 @@ necessary to specify a \verb+record_dir+ in the \verb+connectToServer+
function:
\\
\\
\noindent
\verb
+
std::string record_dir = "log/";
+
\\
\noindent
\verb
+
hfo.connectToServer(features, config_dir,
unum,
port, server_addr,
+
\\
\noindent
\verb
+
hfo.connectToServer(features, config_dir, port, server_addr,
+
\\
\noindent
\verb
+
team_name, goalie, record_dir);
+
\\
\section
{
Randomness
}
...
...
example/communication_agent.cpp
View file @
5923ab98
...
...
@@ -14,7 +14,6 @@ using namespace hfo;
// Server Connection Options. See printouts from bin/HFO.
feature_set_t
features
=
HIGH_LEVEL_FEATURE_SET
;
string
config_dir
=
"bin/teams/base/config/formations-dt"
;
int
unum
=
11
;
int
port
=
6000
;
string
server_addr
=
"localhost"
;
string
team_name
=
"base_left"
;
...
...
@@ -22,16 +21,16 @@ bool goalie = false;
#define PI 3.14159265
int
main
(
int
argc
,
char
**
argv
)
{
if
(
argc
>
2
)
{
unum
=
atoi
(
argv
[
1
]);
port
=
atoi
(
argv
[
2
]);
if
(
argc
>
1
)
{
port
=
atoi
(
argv
[
1
]);
}
// Create the HFO environment
HFOEnvironment
hfo
;
// Connect to the server and request feature set. See manual for
// more information on feature sets.
hfo
.
connectToServer
(
features
,
config_dir
,
unum
,
port
,
server_addr
,
hfo
.
connectToServer
(
features
,
config_dir
,
port
,
server_addr
,
team_name
,
goalie
);
int
unum
=
hfo
.
getUnum
();
for
(
int
episode
=
0
;
episode
<
10
;
episode
++
)
{
int
agent_on_ball
=
7
;
status_t
status
=
IN_GAME
;
...
...
example/communication_agent.py
View file @
5923ab98
...
...
@@ -13,7 +13,7 @@ if __name__ == '__main__':
# Connect to the server with the specified
# feature set. See feature sets in hfo.py/hfo.hpp.
hfo
.
connectToServer
(
HIGH_LEVEL_FEATURE_SET
,
'bin/teams/base/config/formations-dt'
,
11
,
6000
,
'bin/teams/base/config/formations-dt'
,
6000
,
'localhost'
,
'base_left'
,
False
)
for
episode
in
xrange
(
10
):
status
=
IN_GAME
...
...
example/example_high_level_random_agent.py
View file @
5923ab98
...
...
@@ -13,7 +13,7 @@ def main():
# Connect to the server with the specified
# feature set. See feature sets in hfo.py/hfo.hpp.
hfo
.
connectToServer
(
HIGH_LEVEL_FEATURE_SET
,
'bin/teams/base/config/formations-dt'
,
11
,
6000
,
'bin/teams/base/config/formations-dt'
,
6000
,
'localhost'
,
'base_left'
,
False
)
for
episode
in
xrange
(
10
):
status
=
IN_GAME
...
...
example/hfo_example_agent.cpp
View file @
5923ab98
...
...
@@ -12,18 +12,17 @@ using namespace hfo;
// Server Connection Options. See printouts from bin/HFO.
feature_set_t
features
=
LOW_LEVEL_FEATURE_SET
;
string
config_dir
=
"bin/teams/base/config/formations-dt"
;
int
unum
=
11
;
int
port
=
6000
;
string
server_addr
=
"localhost"
;
string
team_name
=
"base_left"
;
bool
goalie
=
fals
e
;
bool
goalie
=
tru
e
;
int
main
()
{
// Create the HFO environment
HFOEnvironment
hfo
;
// Connect to the server and request low-level feature set. See
// manual for more information on feature sets.
hfo
.
connectToServer
(
features
,
config_dir
,
unum
,
port
,
server_addr
,
hfo
.
connectToServer
(
features
,
config_dir
,
port
,
server_addr
,
team_name
,
goalie
);
// Play 5 episodes
for
(
int
episode
=
0
;
episode
<
5
;
episode
++
)
{
...
...
example/hfo_example_agent.py
View file @
5923ab98
...
...
@@ -12,7 +12,7 @@ if __name__ == '__main__':
# Connect to the server with the specified
# feature set. See feature sets in hfo.py/hfo.hpp.
hfo
.
connectToServer
(
LOW_LEVEL_FEATURE_SET
,
'bin/teams/base/config/formations-dt'
,
11
,
6000
,
'bin/teams/base/config/formations-dt'
,
6000
,
'localhost'
,
'base_left'
,
False
)
for
episode
in
xrange
(
10
):
status
=
IN_GAME
...
...
example/high_level_random_agent.cpp
View file @
5923ab98
...
...
@@ -12,7 +12,6 @@ using namespace hfo;
// Server Connection Options. See printouts from bin/HFO.
feature_set_t
features
=
HIGH_LEVEL_FEATURE_SET
;
string
config_dir
=
"bin/teams/base/config/formations-dt"
;
int
unum
=
11
;
int
port
=
6000
;
string
server_addr
=
"localhost"
;
string
team_name
=
"base_left"
;
...
...
@@ -29,7 +28,7 @@ int main(int argc, char** argv) {
HFOEnvironment
hfo
;
// Connect to the server and request high-level feature set. See
// manual for more information on feature sets.
hfo
.
connectToServer
(
features
,
config_dir
,
unum
,
port
,
server_addr
,
hfo
.
connectToServer
(
features
,
config_dir
,
port
,
server_addr
,
team_name
,
goalie
);
for
(
int
episode
=
0
;
episode
<
10
;
episode
++
)
{
status_t
status
=
IN_GAME
;
...
...
example/low_level_random_agent.cpp
View file @
5923ab98
...
...
@@ -12,7 +12,6 @@ using namespace hfo;
// Server Connection Options. See printouts from bin/HFO.
feature_set_t
features
=
LOW_LEVEL_FEATURE_SET
;
string
config_dir
=
"bin/teams/base/config/formations-dt"
;
int
unum
=
11
;
int
port
=
6000
;
string
server_addr
=
"localhost"
;
string
team_name
=
"base_left"
;
...
...
@@ -52,7 +51,7 @@ int main(int argc, char** argv) {
HFOEnvironment
hfo
;
// Connect to the server and request low-level feature set. See
// manual for more information on feature sets.
hfo
.
connectToServer
(
features
,
config_dir
,
unum
,
port
,
server_addr
,
hfo
.
connectToServer
(
features
,
config_dir
,
port
,
server_addr
,
team_name
,
goalie
);
for
(
int
episode
=
0
;
episode
<
10
;
episode
++
)
{
status_t
status
=
IN_GAME
;
...
...
example/mid_level_dribble_agent.cpp
View file @
5923ab98
...
...
@@ -16,7 +16,6 @@ using namespace hfo;
// Server Connection Options. See printouts from bin/HFO.
feature_set_t
features
=
HIGH_LEVEL_FEATURE_SET
;
string
config_dir
=
"bin/teams/base/config/formations-dt"
;
int
unum
=
11
;
int
port
=
6000
;
string
server_addr
=
"localhost"
;
string
team_name
=
"base_left"
;
...
...
@@ -27,7 +26,7 @@ int main(int argc, char** argv) {
HFOEnvironment
hfo
;
// Connect to the server and request low-level feature set. See
// manual for more information on feature sets.
hfo
.
connectToServer
(
features
,
config_dir
,
unum
,
port
,
server_addr
,
hfo
.
connectToServer
(
features
,
config_dir
,
port
,
server_addr
,
team_name
,
goalie
);
for
(
int
episode
=
0
;
episode
<
10
;
episode
++
)
{
status_t
status
=
IN_GAME
;
...
...
example/mid_level_kick_agent.cpp
View file @
5923ab98
...
...
@@ -14,7 +14,6 @@ using namespace hfo;
// Server Connection Options. See printouts from bin/HFO.
feature_set_t
features
=
HIGH_LEVEL_FEATURE_SET
;
string
config_dir
=
"bin/teams/base/config/formations-dt"
;
int
unum
=
11
;
int
port
=
6000
;
string
server_addr
=
"localhost"
;
string
team_name
=
"base_left"
;
...
...
@@ -25,7 +24,7 @@ int main(int argc, char** argv) {
HFOEnvironment
hfo
;
// Connect to the server and request low-level feature set. See
// manual for more information on feature sets.
hfo
.
connectToServer
(
features
,
config_dir
,
unum
,
port
,
server_addr
,
hfo
.
connectToServer
(
features
,
config_dir
,
port
,
server_addr
,
team_name
,
goalie
);
for
(
int
episode
=
0
;
episode
<
10
;
episode
++
)
{
status_t
status
=
IN_GAME
;
...
...
example/mid_level_move_agent.cpp
View file @
5923ab98
...
...
@@ -13,7 +13,6 @@ using namespace hfo;
// Server Connection Options. See printouts from bin/HFO.
feature_set_t
features
=
HIGH_LEVEL_FEATURE_SET
;
string
config_dir
=
"bin/teams/base/config/formations-dt"
;
int
unum
=
11
;
int
port
=
6000
;
string
server_addr
=
"localhost"
;
string
team_name
=
"base_left"
;
...
...
@@ -24,7 +23,7 @@ int main(int argc, char** argv) {
HFOEnvironment
hfo
;
// Connect to the server and request feature set. See manual for
// more information on feature sets.
hfo
.
connectToServer
(
features
,
config_dir
,
unum
,
port
,
server_addr
,
hfo
.
connectToServer
(
features
,
config_dir
,
port
,
server_addr
,
team_name
,
goalie
);
float
target_x
=
.82
;
float
target_y
=
.9
;
...
...
example/passing_agents.sh
View file @
5923ab98
...
...
@@ -2,9 +2,9 @@
./bin/HFO
--offense-agents
=
2
--no-sync
&
sleep
5
./example/communication_agent
7
6000 &
./example/communication_agent 6000 &
sleep
5
./example/communication_agent
11
6000 &
./example/communication_agent 6000 &
# The magic line
# $$ holds the PID for this script
...
...
hfo/hfo.py
View file @
5923ab98
...
...
@@ -52,7 +52,7 @@ hfo_lib.HFO_new.restype = c_void_p
hfo_lib
.
HFO_del
.
argtypes
=
[
c_void_p
]
hfo_lib
.
HFO_del
.
restype
=
None
hfo_lib
.
connectToServer
.
argtypes
=
[
c_void_p
,
c_int
,
c_char_p
,
c_int
,
c_
int
,
c_
char_p
,
c_char_p
,
c_bool
,
c_char_p
]
c_char_p
,
c_char_p
,
c_bool
,
c_char_p
]
hfo_lib
.
connectToServer
.
restype
=
None
hfo_lib
.
getStateSize
.
argtypes
=
[
c_void_p
]
hfo_lib
.
getStateSize
.
restype
=
c_int
...
...
@@ -85,7 +85,6 @@ class HFOEnvironment(object):
def
connectToServer
(
self
,
feature_set
=
LOW_LEVEL_FEATURE_SET
,
config_dir
=
'bin/teams/base/config/formations-dt'
,
uniform_number
=
11
,
server_port
=
6000
,
server_addr
=
'localhost'
,
team_name
=
'base_left'
,
...
...
@@ -97,16 +96,14 @@ class HFOEnvironment(object):
feature_set: High or low level state features
config_dir: Config directory. Typically HFO/bin/teams/base/config/
uniform_number: player's uniform number.
server_port: port to connect to server on
server_addr: address of server
team_name: Name of team to join.
play_goalie: is this player the goalie
record_dir: record agent's states/actions/rewards to this directory
"""
hfo_lib
.
connectToServer
(
self
.
obj
,
feature_set
,
config_dir
,
uniform_number
,
server_port
,
server_addr
,
team_name
,
play_goalie
,
record_dir
)
hfo_lib
.
connectToServer
(
self
.
obj
,
feature_set
,
config_dir
,
server_port
,
server_addr
,
team_name
,
play_goalie
,
record_dir
)
def
getStateSize
(
self
):
""" Returns the number of state features """
...
...
hfo/hfo_c_wrapper.h
View file @
5923ab98
...
...
@@ -12,13 +12,12 @@ extern "C" {
void
connectToServer
(
hfo
::
HFOEnvironment
*
hfo
,
hfo
::
feature_set_t
feature_set
,
char
*
config_dir
,
int
uniform_number
,
int
server_port
,
char
*
server_addr
,
char
*
team_name
,
bool
play_goalie
,
char
*
record_dir
)
{
return
hfo
->
connectToServer
(
feature_set
,
config_dir
,
uniform_number
,
return
hfo
->
connectToServer
(
feature_set
,
config_dir
,
server_port
,
server_addr
,
team_name
,
play_goalie
,
record_dir
);
}
...
...
src/HFO.cpp
View file @
5923ab98
...
...
@@ -31,7 +31,6 @@ HFOEnvironment::~HFOEnvironment() {
void
HFOEnvironment
::
connectToServer
(
feature_set_t
feature_set
,
std
::
string
config_dir
,
int
uniform_number
,
int
server_port
,
std
::
string
server_addr
,
std
::
string
team_name
,
...
...
@@ -40,7 +39,6 @@ void HFOEnvironment::connectToServer(feature_set_t feature_set,
agent
->
setFeatureSet
(
feature_set
);
rcsc
::
PlayerConfig
&
config
=
agent
->
mutable_config
();
config
.
setConfigDir
(
config_dir
);
config
.
setPlayerNumber
(
uniform_number
);
config
.
setPort
(
server_port
);
config
.
setHost
(
server_addr
);
config
.
setTeamName
(
team_name
);
...
...
@@ -102,6 +100,10 @@ std::string HFOEnvironment::hear() {
return
agent
->
getHearMsg
();
}
int
HFOEnvironment
::
getUnum
()
{
return
agent
->
getUnum
();
}
Player
HFOEnvironment
::
playerOnBall
()
{
return
agent
->
getPlayerOnBall
();
}
...
...
src/HFO.hpp
View file @
5923ab98
...
...
@@ -21,7 +21,6 @@ class HFOEnvironment {
*
* feature_set: High or low level state features
* config_dir: Config directory. Typically HFO/bin/teams/base/config/
* uniform_number: player's uniform number.
* server_port: port to connect to server on
* server_addr: address of server
* team_name: Name of team to join.
...
...
@@ -30,7 +29,6 @@ class HFOEnvironment {
*/
void
connectToServer
(
feature_set_t
feature_set
=
HIGH_LEVEL_FEATURE_SET
,
std
::
string
config_dir
=
"bin/teams/base/config/formations-dt"
,
int
uniform_number
=
11
,
int
server_port
=
6000
,
std
::
string
server_addr
=
"localhost"
,
std
::
string
team_name
=
"base_left"
,
...
...
@@ -48,6 +46,9 @@ class HFOEnvironment {
virtual
void
say
(
const
std
::
string
&
message
);
virtual
std
::
string
hear
();
// Returns the uniform number of the player
virtual
int
getUnum
();
// Get the current player holding the ball
virtual
Player
playerOnBall
();
...
...
src/agent.cpp
View file @
5923ab98
...
...
@@ -154,6 +154,10 @@ Agent::~Agent() {
}
}
int
Agent
::
getUnum
()
{
return
world
().
self
().
unum
();
}
bool
Agent
::
initImpl
(
CmdLineParser
&
cmd_parser
)
{
bool
result
=
PlayerAgent
::
initImpl
(
cmd_parser
);
...
...
src/agent.h
View file @
5923ab98
...
...
@@ -60,6 +60,7 @@ protected:
inline
hfo
::
status_t
getGameStatus
()
{
return
game_status
;
}
inline
const
hfo
::
Player
&
getPlayerOnBall
()
{
return
player_on_ball
;
}
inline
const
std
::
string
&
getHearMsg
()
{
return
hear_msg
;
}
int
getUnum
();
// Returns the uniform number of the player
inline
void
setFeatureSet
(
hfo
::
feature_set_t
fset
)
{
feature_set
=
fset
;
}
inline
std
::
vector
<
float
>*
mutable_params
()
{
return
&
params
;
}
...
...
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