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
3b2966b9
Commit
3b2966b9
authored
Sep 11, 2018
by
CoolPhilChen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Revert "add a low-level random kick agent"
This reverts commit
19e3cd72
.
parent
f5748334
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
0 additions
and
58 deletions
+0
-58
example/low_level_random_kick_agent.py
example/low_level_random_kick_agent.py
+0
-58
No files found.
example/low_level_random_kick_agent.py
deleted
100644 → 0
View file @
f5748334
#!/usr/bin/env python3
# encoding: utf-8
from
hfo
import
*
import
argparse
import
numpy
as
np
import
math
as
m
import
sys
,
os
import
itertools
def
rad_to_deg
(
rad
):
return
rad
/
m
.
pi
*
180
def
sign
(
x
):
return
(
int
(
x
>=
0
)
-
0.5
)
*
2
if
__name__
==
'__main__'
:
parser
=
argparse
.
ArgumentParser
()
parser
.
add_argument
(
'--port'
,
type
=
int
,
default
=
6000
,
help
=
"Server port"
)
args
=
parser
.
parse_args
()
hfo
=
HFOEnvironment
()
hfo
.
connectToServer
(
LOW_LEVEL_FEATURE_SET
,
'/bin/teams/base/config/formations-dt'
,
args
.
port
,
'localhost'
,
'base_left'
,
False
)
States
,
Actions
,
Statuses
=
[],
[],
[]
for
episode
in
itertools
.
count
():
status
=
IN_GAME
while
status
==
IN_GAME
:
state
=
hfo
.
getState
()
if
int
(
state
[
12
])
==
1
:
# Kickable = 1
goal_center_angle
=
rad_to_deg
(
m
.
acos
(
state
[
14
]))
*
sign
(
m
.
asin
(
state
[
13
]))
# turn to goal center
if
abs
(
goal_center_angle
)
>
45
:
hfo
.
act
(
1
,
goal_center_angle
)
# kick
else
:
power
=
np
.
random
.
uniform
(
0
,
100
)
hfo
.
act
(
3
,
power
,
goal_center_angle
)
else
:
# Kickable = -1
ball_angle
=
rad_to_deg
(
m
.
acos
(
state
[
52
]))
*
sign
(
m
.
asin
(
state
[
51
]))
# turn to ball
if
abs
(
ball_angle
)
>
10
:
hfo
.
act
(
1
,
ball_angle
)
# go to ball
else
:
power
=
np
.
random
.
uniform
(
0
,
100
)
hfo
.
act
(
0
,
power
,
ball_angle
)
status
=
hfo
.
step
()
#--------------- end of while loop ------------------------------------------------------
# Quit if the server goes down
if
status
==
SERVER_DOWN
:
hfo
.
act
(
QUIT
)
break
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