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
85a0d4aa
Commit
85a0d4aa
authored
Aug 06, 2017
by
drallensmith
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Revise feedback with enum, use of ACTION_STATUS_UNKNOWN when appropriate
parent
2be132c1
Changes
11
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
300 additions
and
112 deletions
+300
-112
doc/manual.pdf
doc/manual.pdf
+0
-0
doc/manual.tex
doc/manual.tex
+3
-3
example/explore_offense_actions_fullstate.py
example/explore_offense_actions_fullstate.py
+116
-25
hfo/hfo.py
hfo/hfo.py
+3
-3
src/HFO.cpp
src/HFO.cpp
+1
-1
src/HFO.hpp
src/HFO.hpp
+1
-1
src/agent.cpp
src/agent.cpp
+97
-54
src/agent.h
src/agent.h
+15
-12
src/bhv_basic_move.cpp
src/bhv_basic_move.cpp
+22
-8
src/bhv_basic_move.h
src/bhv_basic_move.h
+3
-1
src/common.hpp
src/common.hpp
+39
-4
No files found.
doc/manual.pdf
View file @
85a0d4aa
No preview for this file type
doc/manual.tex
View file @
85a0d4aa
...
...
@@ -622,13 +622,13 @@ Team. unum invalid & Y & Y & Y & Y & Y & Y & Y & Y & Y & Y & N &
Opponent loc invalid
&
Y
&
Y
&
Y
&
Y
&
Y
&
Y
&
Y?
&
Y
&
N
&
Y?
&
Y
&
Y?
&
Y
&
Y
&
Y
&
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N?
&
N?
&
Y
&
N
&
Y
&
Y
&
N
&
N
&
N
&
N
&
Y
&
?
&
Y
&
Y
\\
...
...
example/explore_offense_actions_fullstate.py
View file @
85a0d4aa
This diff is collapsed.
Click to expand it.
hfo/hfo.py
View file @
85a0d4aa
...
...
@@ -68,9 +68,6 @@ STATUS_STRINGS = {IN_GAME: "InGame",
OUT_OF_TIME
:
"OutOfTime"
,
SERVER_DOWN
:
"ServerDown"
}
"""Possible sides."""
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
...
...
@@ -78,6 +75,9 @@ ACTION_STATUS_STRINGS = {ACTION_STATUS_UNKNOWN: "Unknown",
ACTION_STATUS_BAD
:
"Bad"
,
ACTION_STATUS_MAYBE
:
"MaybeOK"
}
"""Possible sides."""
RIGHT
,
NEUTRAL
,
LEFT
=
list
(
range
(
-
1
,
2
))
class
Player
(
Structure
):
pass
Player
.
_fields_
=
[
(
'side'
,
c_int
),
...
...
src/HFO.cpp
View file @
85a0d4aa
...
...
@@ -123,7 +123,7 @@ int HFOEnvironment::getNumOpponents() {
return
agent
->
getNumOpponents
();
}
in
t
HFOEnvironment
::
getLastActionStatus
(
action_t
last_action
)
{
action_status_
t
HFOEnvironment
::
getLastActionStatus
(
action_t
last_action
)
{
return
agent
->
getLastActionStatus
(
last_action
);
}
...
...
src/HFO.hpp
View file @
85a0d4aa
...
...
@@ -55,7 +55,7 @@ class HFOEnvironment {
// Returns the number of opponents
virtual
int
getNumOpponents
();
virtual
in
t
getLastActionStatus
(
action_t
last_action
);
virtual
action_status_
t
getLastActionStatus
(
action_t
last_action
);
// Get the current player holding the ball
virtual
Player
playerOnBall
();
...
...
src/agent.cpp
View file @
85a0d4aa
This diff is collapsed.
Click to expand it.
src/agent.h
View file @
85a0d4aa
// -*-c++-*-
#ifndef AGENT_H
#define AGENT_H
...
...
@@ -64,7 +66,7 @@ protected:
int
num_teammates
;
// Number of teammates
int
num_opponents
;
// Number of opponents
hfo
::
action_t
last_action_with_status
;
// Last action with a recorded return status
int
last_action_status
;
// Recorded return status of last action (1 = true, 0 = false, -1 = not available)
hfo
::
action_status_t
last_action_status
;
// Recorded return status of last action
public:
inline
const
std
::
vector
<
float
>&
getState
()
{
return
state
;
}
...
...
@@ -74,7 +76,7 @@ protected:
int
getUnum
();
// Returns the uniform number of the player
inline
int
getNumTeammates
()
{
return
num_teammates
;
}
inline
int
getNumOpponents
()
{
return
num_opponents
;
}
in
t
getLastActionStatus
(
hfo
::
action_t
last_action
);
// if last_action is correct, returns status if available
hfo
::
action_status_
t
getLastActionStatus
(
hfo
::
action_t
last_action
);
// if last_action is correct, returns status if available
inline
void
setFeatureSet
(
hfo
::
feature_set_t
fset
)
{
feature_set
=
fset
;
}
inline
std
::
vector
<
float
>*
mutable_params
()
{
return
&
params
;
}
...
...
@@ -83,21 +85,22 @@ protected:
private:
bool
doPreprocess
();
bool
doSmartKick
();
bool
doShoot
();
hfo
::
action_status_t
doSmartKick
();
hfo
::
action_status_t
doShoot
();
bool
doPass
();
bool
doPassTo
(
int
receiver
);
bool
doDribble
();
bool
doMove
();
hfo
::
action_status_t
doPassTo
(
int
receiver
);
hfo
::
action_status_t
doDribble
();
hfo
::
action_status_t
doMove
();
bool
doForceKick
();
bool
doHeardPassReceive
();
bool
doMarkPlayer
(
int
unum
);
hfo
::
action_status_t
doMarkPlayer
(
int
unum
);
bool
doMarkPlayerNearIndex
(
int
near_index
);
bool
doReduceAngleToGoal
();
bool
doDefendGoal
();
bool
doGoToBall
();
hfo
::
action_status_t
doReduceAngleToGoal
();
hfo
::
action_status_t
doDefendGoal
();
hfo
::
action_status_t
doGoToBall
();
bool
doNewAction1
();
void
addLastActionStatus
(
hfo
::
action_t
last_action
,
bool
action_status
);
void
addLastActionStatus
(
hfo
::
action_t
last_action
,
hfo
::
action_status_t
action_status
);
void
addLastActionStatusCollision
(
hfo
::
action_t
last_action
,
bool
may_fix
,
bool
likely_success
);
Communication
::
Ptr
M_communication
;
...
...
src/bhv_basic_move.cpp
View file @
85a0d4aa
...
...
@@ -48,25 +48,36 @@
#include <rcsc/common/server_param.h>
#include "neck_offensive_intercept_neck.h"
#include "common.hpp"
using
namespace
rcsc
;
bool
Bhv_BasicMove
::
execute
(
PlayerAgent
*
agent
)
{
if
(
Bhv_BasicMove
::
action_execute
(
agent
)
==
hfo
::
ACTION_STATUS_MAYBE
)
{
return
true
;
}
else
{
return
false
;
}
}
/*-------------------------------------------------------------------*/
/*!
*/
bool
Bhv_BasicMove
::
execute
(
PlayerAgent
*
agent
)
hfo
::
action_status_t
Bhv_BasicMove
::
action_
execute
(
PlayerAgent
*
agent
)
{
dlog
.
addText
(
Logger
::
TEAM
,
__FILE__
": Bhv_BasicMove"
);
bool
success
=
true
;
hfo
::
action_status_t
success
=
hfo
::
ACTION_STATUS_UNKNOWN
;
//-----------------------------------------------
// tackle
if
(
Bhv_BasicTackle
(
0.8
,
80.0
).
execute
(
agent
)
)
{
return
true
;
return
hfo
::
ACTION_STATUS_MAYBE
;
}
const
WorldModel
&
wm
=
agent
->
world
();
...
...
@@ -85,9 +96,8 @@ Bhv_BasicMove::execute( PlayerAgent * agent )
{
dlog
.
addText
(
Logger
::
TEAM
,
__FILE__
": intercept"
);
success
=
Body_Intercept
().
execute
(
agent
);
success
=
hfo
::
BooleanToActionStatus
(
Body_Intercept
().
execute
(
agent
)
);
agent
->
setNeckAction
(
new
Neck_OffensiveInterceptNeck
()
);
return
success
;
}
...
...
@@ -96,7 +106,9 @@ Bhv_BasicMove::execute( PlayerAgent * agent )
const
BallObject
&
ball
=
wm
.
ball
();
if
(
!
ball
.
rposValid
())
{
success
=
false
;
if
(
!
wm
.
self
().
collidesWithPost
())
{
success
=
hfo
::
ACTION_STATUS_BAD
;
}
}
double
dist_thr
=
ball
.
distFromSelf
()
*
0.1
;
...
...
@@ -115,8 +127,10 @@ Bhv_BasicMove::execute( PlayerAgent * agent )
).
execute
(
agent
)
)
{
if
(
!
Body_TurnToBall
().
execute
(
agent
))
{
success
=
false
;
success
=
hfo
::
ACTION_STATUS_BAD
;
}
}
else
if
(
success
!=
hfo
::
ACTION_STATUS_BAD
)
{
success
=
hfo
::
ACTION_STATUS_MAYBE
;
}
if
(
wm
.
existKickableOpponent
()
&&
...
...
src/bhv_basic_move.h
View file @
85a0d4aa
...
...
@@ -29,6 +29,7 @@
#include <rcsc/geom/vector_2d.h>
#include <rcsc/player/soccer_action.h>
#include "common.hpp"
class
Bhv_BasicMove
:
public
rcsc
::
SoccerBehavior
{
...
...
@@ -37,6 +38,7 @@ public:
{
}
bool
execute
(
rcsc
::
PlayerAgent
*
agent
);
hfo
::
action_status_t
action_execute
(
rcsc
::
PlayerAgent
*
agent
);
private:
double
getDashPower
(
const
rcsc
::
PlayerAgent
*
agent
);
...
...
src/common.hpp
View file @
85a0d4aa
...
...
@@ -5,6 +5,7 @@
#include <stdlib.h>
#include <iostream>
#include <sstream>
#include <vector>
namespace
hfo
{
...
...
@@ -40,7 +41,7 @@ enum action_t
GO_TO_BALL
};
// Status of a HFO game
// Status of a
n
HFO game
enum
status_t
{
IN_GAME
,
// Game is currently active
...
...
@@ -51,6 +52,24 @@ enum status_t
SERVER_DOWN
// Server is not alive
};
// Action status
enum
action_status_t
{
ACTION_STATUS_UNKNOWN
=
-
1
,
// cannot tell or invalid action # in status request
ACTION_STATUS_BAD
=
0
,
// definitely not OK
ACTION_STATUS_MAYBE
=
1
,
// may be OK, may not
};
/**
* Translates from boolean false (bad) or true (maybe OK) to action status
*/
inline
action_status_t
BooleanToActionStatus
(
const
bool
status
)
{
if
(
status
)
{
return
ACTION_STATUS_MAYBE
;
}
else
{
return
ACTION_STATUS_BAD
;
}
}
// Configuration of the HFO domain including the team names and player
// numbers for each team. This struct is populated by ParseConfig().
struct
Config
{
...
...
@@ -171,7 +190,7 @@ inline std::string ActionToString(action_t action) {
};
/**
* Returns a string representation of a game
_
status.
* Returns a string representation of a game
status.
*/
inline
std
::
string
StatusToString
(
status_t
status
)
{
switch
(
status
)
{
...
...
@@ -192,6 +211,22 @@ inline std::string StatusToString(status_t status) {
}
};
/**
* Returns a string representation of an action status.
*/
inline
std
::
string
ActionStatusToString
(
action_status_t
status
)
{
switch
(
status
)
{
case
ACTION_STATUS_BAD
:
return
"Bad"
;
case
ACTION_STATUS_MAYBE
:
return
"MaybeOK"
;
case
ACTION_STATUS_UNKNOWN
:
return
"Unknown"
;
default:
return
"Invalid"
;
}
}
/**
* Parse a Trainer message to populate config. Returns a bool
* indicating if the struct was correctly parsed.
...
...
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