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
1b3d7b4a
Commit
1b3d7b4a
authored
Nov 14, 2017
by
DURGESH P SAMANT
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Teammate and Opponent high level features ordered by proximity to agent
parent
fe899441
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
37 additions
and
23 deletions
+37
-23
src/highlevel_feature_extractor.cpp
src/highlevel_feature_extractor.cpp
+33
-23
src/highlevel_feature_extractor.h
src/highlevel_feature_extractor.h
+4
-0
No files found.
src/highlevel_feature_extractor.cpp
View file @
1b3d7b4a
...
...
@@ -30,8 +30,8 @@ HighLevelFeatureExtractor::ExtractFeatures(const rcsc::WorldModel& wm,
const
SelfObject
&
self
=
wm
.
self
();
const
Vector2D
&
self_pos
=
self
.
pos
();
const
float
self_ang
=
self
.
body
().
radian
();
const
Player
Cont
&
teammates
=
wm
.
teammates
();
const
Player
Cont
&
opponents
=
wm
.
opponents
();
const
Player
PtrCont
&
teammates
=
wm
.
teammatesFromSelf
();
const
Player
PtrCont
&
opponents
=
wm
.
opponentsFromSelf
();
float
maxR
=
sqrtf
(
SP
.
pitchHalfLength
()
*
SP
.
pitchHalfLength
()
+
SP
.
pitchHalfWidth
()
*
SP
.
pitchHalfWidth
());
// features about self pos
...
...
@@ -89,10 +89,10 @@ HighLevelFeatureExtractor::ExtractFeatures(const rcsc::WorldModel& wm,
// Features[9 - 9+T]: teammate's open angle to goal
int
detected_teammates
=
0
;
for
(
PlayerCont
::
const_iterator
it
=
teammates
.
begin
();
it
!=
teammates
.
end
();
++
it
)
{
const
PlayerObject
&
teammate
=
*
it
;
for
(
Player
Ptr
Cont
::
const_iterator
it
=
teammates
.
begin
();
it
!=
teammates
.
end
();
++
it
)
{
const
PlayerObject
*
teammate
=
*
it
;
if
(
valid
(
teammate
)
&&
detected_teammates
<
numTeammates
)
{
addNormFeature
(
calcLargestGoalAngle
(
wm
,
teammate
.
pos
()),
0
,
M_PI
);
addNormFeature
(
calcLargestGoalAngle
(
wm
,
teammate
->
pos
()),
0
,
M_PI
);
detected_teammates
++
;
}
}
...
...
@@ -104,10 +104,10 @@ HighLevelFeatureExtractor::ExtractFeatures(const rcsc::WorldModel& wm,
// Features[9+T - 9+2T]: teammates' dists to closest opps
if
(
numOpponents
>
0
)
{
detected_teammates
=
0
;
for
(
PlayerCont
::
const_iterator
it
=
teammates
.
begin
();
it
!=
teammates
.
end
();
++
it
)
{
const
PlayerObject
&
teammate
=
*
it
;
for
(
Player
Ptr
Cont
::
const_iterator
it
=
teammates
.
begin
();
it
!=
teammates
.
end
();
++
it
)
{
const
PlayerObject
*
teammate
=
*
it
;
if
(
valid
(
teammate
)
&&
detected_teammates
<
numTeammates
)
{
calcClosestOpp
(
wm
,
teammate
.
pos
(),
th
,
r
);
calcClosestOpp
(
wm
,
teammate
->
pos
(),
th
,
r
);
addNormFeature
(
r
,
0
,
maxR
);
detected_teammates
++
;
}
...
...
@@ -124,10 +124,10 @@ HighLevelFeatureExtractor::ExtractFeatures(const rcsc::WorldModel& wm,
// Features [9+2T - 9+3T]: open angle to teammates
detected_teammates
=
0
;
for
(
PlayerCont
::
const_iterator
it
=
teammates
.
begin
();
it
!=
teammates
.
end
();
++
it
)
{
const
PlayerObject
&
teammate
=
*
it
;
for
(
Player
Ptr
Cont
::
const_iterator
it
=
teammates
.
begin
();
it
!=
teammates
.
end
();
++
it
)
{
const
PlayerObject
*
teammate
=
*
it
;
if
(
valid
(
teammate
)
&&
detected_teammates
<
numTeammates
)
{
addNormFeature
(
calcLargestTeammateAngle
(
wm
,
self_pos
,
teammate
.
pos
()),
0
,
M_PI
);
addNormFeature
(
calcLargestTeammateAngle
(
wm
,
self_pos
,
teammate
->
pos
()),
0
,
M_PI
);
detected_teammates
++
;
}
}
...
...
@@ -138,16 +138,16 @@ HighLevelFeatureExtractor::ExtractFeatures(const rcsc::WorldModel& wm,
// Features [9+3T - 9+6T]: x, y, unum of teammates
detected_teammates
=
0
;
for
(
PlayerCont
::
const_iterator
it
=
teammates
.
begin
();
it
!=
teammates
.
end
();
++
it
)
{
const
PlayerObject
&
teammate
=
*
it
;
for
(
Player
Ptr
Cont
::
const_iterator
it
=
teammates
.
begin
();
it
!=
teammates
.
end
();
++
it
)
{
const
PlayerObject
*
teammate
=
*
it
;
if
(
valid
(
teammate
)
&&
detected_teammates
<
numTeammates
)
{
if
(
playingOffense
)
{
addNormFeature
(
teammate
.
pos
().
x
,
-
tolerance_x
,
SP
.
pitchHalfLength
()
+
tolerance_x
);
addNormFeature
(
teammate
->
pos
().
x
,
-
tolerance_x
,
SP
.
pitchHalfLength
()
+
tolerance_x
);
}
else
{
addNormFeature
(
teammate
.
pos
().
x
,
-
SP
.
pitchHalfLength
()
-
tolerance_x
,
tolerance_x
);
addNormFeature
(
teammate
->
pos
().
x
,
-
SP
.
pitchHalfLength
()
-
tolerance_x
,
tolerance_x
);
}
addNormFeature
(
teammate
.
pos
().
y
,
-
tolerance_y
-
SP
.
pitchHalfWidth
(),
SP
.
pitchHalfWidth
()
+
tolerance_y
);
addFeature
(
teammate
.
unum
());
addNormFeature
(
teammate
->
pos
().
y
,
-
tolerance_y
-
SP
.
pitchHalfWidth
(),
SP
.
pitchHalfWidth
()
+
tolerance_y
);
addFeature
(
teammate
->
unum
());
detected_teammates
++
;
}
}
...
...
@@ -160,16 +160,16 @@ HighLevelFeatureExtractor::ExtractFeatures(const rcsc::WorldModel& wm,
// Features [9+6T - 9+6T+3O]: x, y, unum of opponents
int
detected_opponents
=
0
;
for
(
PlayerCont
::
const_iterator
it
=
opponents
.
begin
();
it
!=
opponents
.
end
();
++
it
)
{
const
PlayerObject
&
opponent
=
*
it
;
for
(
Player
Ptr
Cont
::
const_iterator
it
=
opponents
.
begin
();
it
!=
opponents
.
end
();
++
it
)
{
const
PlayerObject
*
opponent
=
*
it
;
if
(
valid
(
opponent
)
&&
detected_opponents
<
numOpponents
)
{
if
(
playingOffense
)
{
addNormFeature
(
opponent
.
pos
().
x
,
-
tolerance_x
,
SP
.
pitchHalfLength
()
+
tolerance_x
);
addNormFeature
(
opponent
->
pos
().
x
,
-
tolerance_x
,
SP
.
pitchHalfLength
()
+
tolerance_x
);
}
else
{
addNormFeature
(
opponent
.
pos
().
x
,
-
SP
.
pitchHalfLength
()
-
tolerance_x
,
tolerance_x
);
addNormFeature
(
opponent
->
pos
().
x
,
-
SP
.
pitchHalfLength
()
-
tolerance_x
,
tolerance_x
);
}
addNormFeature
(
opponent
.
pos
().
y
,
-
tolerance_y
-
SP
.
pitchHalfWidth
(),
SP
.
pitchHalfWidth
()
+
tolerance_y
);
addFeature
(
opponent
.
unum
());
addNormFeature
(
opponent
->
pos
().
y
,
-
tolerance_y
-
SP
.
pitchHalfWidth
(),
SP
.
pitchHalfWidth
()
+
tolerance_y
);
addFeature
(
opponent
->
unum
());
detected_opponents
++
;
}
}
...
...
@@ -190,3 +190,13 @@ HighLevelFeatureExtractor::ExtractFeatures(const rcsc::WorldModel& wm,
// checkFeatures();
return
feature_vec
;
}
bool
HighLevelFeatureExtractor
::
valid
(
const
rcsc
::
PlayerObject
*
player
)
{
if
(
!
player
)
{
return
false
;}
//avoid segfaults
const
rcsc
::
Vector2D
&
pos
=
player
->
pos
();
if
(
!
player
->
posValid
())
{
return
false
;
}
return
pos
.
isValid
();
}
src/highlevel_feature_extractor.h
View file @
1b3d7b4a
...
...
@@ -23,6 +23,10 @@ public:
virtual
const
std
::
vector
<
float
>&
ExtractFeatures
(
const
rcsc
::
WorldModel
&
wm
,
bool
last_action_status
);
//override FeatureExtractor::valid
//this method takes a pointer instead of a reference
static
bool
valid
(
const
rcsc
::
PlayerObject
*
player
);
protected:
// Number of features for non-player objects.
const
static
int
num_basic_features
=
10
;
...
...
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