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
b336a23f
Commit
b336a23f
authored
Feb 23, 2016
by
Matthew Hausknecht
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Updates for OSX compatibility.
parent
b146090a
Changes
13
Hide whitespace changes
Inline
Side-by-side
Showing
13 changed files
with
22 additions
and
16 deletions
+22
-16
CMakeLists.txt
CMakeLists.txt
+4
-0
example/communication_agent.cpp
example/communication_agent.cpp
+2
-2
example/example_high_level_random_agent.py
example/example_high_level_random_agent.py
+2
-1
example/hfo_example_agent.cpp
example/hfo_example_agent.cpp
+1
-1
example/high_level_random_agent.cpp
example/high_level_random_agent.cpp
+1
-1
example/low_level_random_agent.cpp
example/low_level_random_agent.cpp
+4
-3
example/mid_level_dribble_agent.cpp
example/mid_level_dribble_agent.cpp
+1
-1
example/mid_level_kick_agent.cpp
example/mid_level_kick_agent.cpp
+1
-1
example/mid_level_move_agent.cpp
example/mid_level_move_agent.cpp
+1
-1
example/passing_agents.sh
example/passing_agents.sh
+2
-2
hfo/hfo.py
hfo/hfo.py
+2
-2
hfo/hfo_c_wrapper.h
hfo/hfo_c_wrapper.h
+1
-0
src/agent.cpp
src/agent.cpp
+0
-1
No files found.
CMakeLists.txt
View file @
b336a23f
...
...
@@ -62,6 +62,10 @@ if(INSTALL_ADDITIONAL_TEAMS)
endif
()
endif
()
if
(
APPLE
)
set
(
CMAKE_SHARED_LIBRARY_SUFFIX
".so"
)
endif
()
set
(
SOURCE_DIR
${
CMAKE_CURRENT_SOURCE_DIR
}
/src
)
set
(
CMAKE_RUNTIME_OUTPUT_DIRECTORY bin
)
include_directories
(
${
SOURCE_DIR
}
${
SOURCE_DIR
}
/chain_action
)
...
...
example/communication_agent.cpp
View file @
b336a23f
...
...
@@ -15,7 +15,7 @@ using namespace hfo;
feature_set_t
features
=
HIGH_LEVEL_FEATURE_SET
;
string
config_dir
=
"bin/teams/base/config/formations-dt"
;
int
unum
=
11
;
int
port
=
600
1
;
int
port
=
600
0
;
string
server_addr
=
"localhost"
;
string
team_name
=
"base_left"
;
bool
goalie
=
false
;
...
...
@@ -50,7 +50,7 @@ int main(int argc, char** argv) {
float
y_pos
=
feature_vec
[
1
];
float
target_x
=
0
;
float
target_y
=
unum
==
11
?
.3
:
-
.3
;
bool
in_position
=
(
pow
(
x_pos
-
target_x
,
2
)
+
pow
(
y_pos
-
target_y
,
2
))
<
.00
05
;
bool
in_position
=
(
pow
(
x_pos
-
target_x
,
2
)
+
pow
(
y_pos
-
target_y
,
2
))
<
.00
1
;
bool
able_to_kick
=
feature_vec
[
5
]
>
0
;
if
(
agent_on_ball
==
unum
&&
in_position
&&
able_to_kick
)
{
int
teammate_unum
=
unum
==
11
?
7
:
11
;
...
...
example/example_high_level_random_agent.py
View file @
b336a23f
...
...
@@ -24,7 +24,8 @@ def main():
else
:
hfo
.
act
(
MOVE
)
status
=
hfo
.
step
()
print
'Episode'
,
episode
,
'ended with'
,
hfo
.
statusToString
(
status
)
# print 'Episode', episode, 'ended with', hfo.statusToString(status)
print
(
'Episode
%
d ended with
%
s'
%
(
episode
,
hfo
.
statusToString
(
status
)))
if
__name__
==
'__main__'
:
main
()
example/hfo_example_agent.cpp
View file @
b336a23f
...
...
@@ -13,7 +13,7 @@ using namespace hfo;
feature_set_t
features
=
LOW_LEVEL_FEATURE_SET
;
string
config_dir
=
"bin/teams/base/config/formations-dt"
;
int
unum
=
11
;
int
port
=
600
1
;
int
port
=
600
0
;
string
server_addr
=
"localhost"
;
string
team_name
=
"base_left"
;
bool
goalie
=
false
;
...
...
example/high_level_random_agent.cpp
View file @
b336a23f
...
...
@@ -13,7 +13,7 @@ using namespace hfo;
feature_set_t
features
=
HIGH_LEVEL_FEATURE_SET
;
string
config_dir
=
"bin/teams/base/config/formations-dt"
;
int
unum
=
11
;
int
port
=
600
1
;
int
port
=
600
0
;
string
server_addr
=
"localhost"
;
string
team_name
=
"base_left"
;
bool
goalie
=
false
;
...
...
example/low_level_random_agent.cpp
View file @
b336a23f
...
...
@@ -13,7 +13,7 @@ using namespace hfo;
feature_set_t
features
=
LOW_LEVEL_FEATURE_SET
;
string
config_dir
=
"bin/teams/base/config/formations-dt"
;
int
unum
=
11
;
int
port
=
600
1
;
int
port
=
600
0
;
string
server_addr
=
"localhost"
;
string
team_name
=
"base_left"
;
bool
goalie
=
false
;
...
...
@@ -23,7 +23,6 @@ float arg1, arg2;
// Returns a random low-level action
action_t
get_random_low_lv_action
()
{
action_t
action_indx
=
(
action_t
)
((
rand
()
%
4
)
+
DASH
);
std
::
cout
<<
action_indx
<<
std
::
endl
;
switch
(
action_indx
)
{
case
DASH
:
arg1
=
(
rand
()
/
float
(
RAND_MAX
))
*
200
-
100
;
// power: [-100, 100]
...
...
@@ -55,7 +54,7 @@ int main(int argc, char** argv) {
// manual for more information on feature sets.
hfo
.
connectToServer
(
features
,
config_dir
,
unum
,
port
,
server_addr
,
team_name
,
goalie
);
for
(
int
episode
=
0
;
;
episode
++
)
{
for
(
int
episode
=
0
;
episode
<
10
;
episode
++
)
{
status_t
status
=
IN_GAME
;
while
(
status
==
IN_GAME
)
{
// Get the vector of state features for the current state
...
...
@@ -65,6 +64,8 @@ int main(int argc, char** argv) {
// Advance the environment and recieve current game status
status
=
hfo
.
step
();
}
cout
<<
"Episode "
<<
episode
<<
" ended with status: "
<<
StatusToString
(
status
)
<<
std
::
endl
;;
}
hfo
.
act
(
QUIT
);
};
example/mid_level_dribble_agent.cpp
View file @
b336a23f
...
...
@@ -17,7 +17,7 @@ using namespace hfo;
feature_set_t
features
=
HIGH_LEVEL_FEATURE_SET
;
string
config_dir
=
"bin/teams/base/config/formations-dt"
;
int
unum
=
11
;
int
port
=
600
1
;
int
port
=
600
0
;
string
server_addr
=
"localhost"
;
string
team_name
=
"base_left"
;
bool
goalie
=
false
;
...
...
example/mid_level_kick_agent.cpp
View file @
b336a23f
...
...
@@ -15,7 +15,7 @@ using namespace hfo;
feature_set_t
features
=
HIGH_LEVEL_FEATURE_SET
;
string
config_dir
=
"bin/teams/base/config/formations-dt"
;
int
unum
=
11
;
int
port
=
600
1
;
int
port
=
600
0
;
string
server_addr
=
"localhost"
;
string
team_name
=
"base_left"
;
bool
goalie
=
false
;
...
...
example/mid_level_move_agent.cpp
View file @
b336a23f
...
...
@@ -14,7 +14,7 @@ using namespace hfo;
feature_set_t
features
=
HIGH_LEVEL_FEATURE_SET
;
string
config_dir
=
"bin/teams/base/config/formations-dt"
;
int
unum
=
11
;
int
port
=
600
1
;
int
port
=
600
0
;
string
server_addr
=
"localhost"
;
string
team_name
=
"base_left"
;
bool
goalie
=
false
;
...
...
example/passing_agents.sh
View file @
b336a23f
#!/bin/bash
./bin/HFO
--offense-agents
=
2
--no-sync
&
sleep
1
sleep
5
./example/communication_agent 7 6000 &
sleep
1
sleep
5
./example/communication_agent 11 6000 &
# The magic line
...
...
hfo/hfo.py
View file @
b336a23f
...
...
@@ -112,8 +112,8 @@ class HFOEnvironment(object):
n_params
=
hfo_lib
.
numParams
(
action_type
)
assert
n_params
==
len
(
args
)
-
1
,
'Incorrect number of params to act: '
\
'Required
%
d, provided
%
d'
%
(
n_params
,
len
(
args
)
-
1
)
hfo_lib
.
act
(
self
.
obj
,
action_type
,
as_ctypes
(
np
.
asarray
(
args
[
1
:],
dtype
=
np
.
float32
)))
params
=
np
.
asarray
(
args
[
1
:],
dtype
=
np
.
float32
)
hfo_lib
.
act
(
self
.
obj
,
action_type
,
params
.
ctypes
.
data_as
(
POINTER
(
c_float
)))
def
say
(
self
,
message
):
""" Transmit a message """
...
...
hfo/hfo_c_wrapper.h
View file @
b336a23f
...
...
@@ -44,6 +44,7 @@ extern "C" {
return
ActionToString
(
action
).
c_str
();
}
const
char
*
statusToString
(
const
hfo
::
status_t
status
)
{
StatusToString
(
status
);
// TODO: OSX requires two calls...?!
return
StatusToString
(
status
).
c_str
();
}
}
...
...
src/agent.cpp
View file @
b336a23f
...
...
@@ -326,7 +326,6 @@ void Agent::actionImpl() {
this
->
doSmartKick
();
break
;
case
PASS
:
std
::
cout
<<
"Inagent pass: 0: "
<<
params
[
0
]
<<
std
::
endl
;
this
->
doPassTo
(
int
(
params
[
0
]));
break
;
case
DRIBBLE
:
...
...
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