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
aaf8751c
You need to sign in or sign up before continuing.
Commit
aaf8751c
authored
Aug 23, 2015
by
Matthew Hausknecht
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Switched back to normalized features.
parent
dda0c9d0
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
33 additions
and
23 deletions
+33
-23
src/highlevel_feature_extractor.cpp
src/highlevel_feature_extractor.cpp
+33
-23
No files found.
src/highlevel_feature_extractor.cpp
View file @
aaf8751c
...
...
@@ -41,12 +41,21 @@ const std::vector<float>& HighLevelFeatureExtractor::ExtractFeatures(
// Allow the agent to go 10% over the playfield in any direction
float
tolerance_x
=
.1
*
SP
.
pitchHalfLength
();
float
tolerance_y
=
.1
*
SP
.
pitchHalfWidth
();
// Feature[0]: Xpostion
addFeature
(
self_pos
.
x
);
// Feature[1]: YPosition
addFeature
(
self_pos
.
y
);
// Feature[0]: X-postion
if
(
playingOffense
)
{
addNormFeature
(
self_pos
.
x
,
-
tolerance_x
,
SP
.
pitchHalfLength
()
+
tolerance_x
);
}
else
{
addNormFeature
(
self_pos
.
x
,
-
SP
.
pitchHalfLength
()
-
tolerance_x
,
tolerance_x
);
}
// addFeature(self_pos.x);
// Feature[1]: Y-Position
addNormFeature
(
self_pos
.
y
,
-
SP
.
pitchHalfWidth
()
-
tolerance_y
,
SP
.
pitchHalfWidth
()
+
tolerance_y
);
// addFeature(self_pos.y);
// Feature[2]: Self Angle
addFeature
(
self_ang
);
add
NormFeature
(
self_ang
,
-
2
*
M_PI
,
2
*
M_PI
);
// add
Feature(self_ang);
float
r
;
float
th
;
...
...
@@ -54,11 +63,11 @@ const std::vector<float>& HighLevelFeatureExtractor::ExtractFeatures(
Vector2D
ball_pos
=
wm
.
ball
().
pos
();
angleDistToPoint
(
self_pos
,
ball_pos
,
th
,
r
);
// Feature[3]: Dist to ball
addFeature
(
r
);
add
NormFeature
(
r
,
0
,
maxR
);
// add
Feature(r);
// Feature[4]: Ang to ball
addFeature
(
th
);
add
NormFeature
(
th
,
-
2
*
M_PI
,
2
*
M_PI
);
// add
Feature(th);
// Feature[5]: Able to kick
addFeature
(
self
.
isKickable
());
add
NormFeature
(
self
.
isKickable
(),
false
,
true
);
// add
Feature(self.isKickable());
// features about distance to goal center
Vector2D
goalCenter
(
SP
.
pitchHalfLength
(),
0
);
...
...
@@ -67,18 +76,20 @@ const std::vector<float>& HighLevelFeatureExtractor::ExtractFeatures(
}
angleDistToPoint
(
self_pos
,
goalCenter
,
th
,
r
);
// Feature[6]: Goal Center Distance
addFeature
(
r
);
add
NormFeature
(
r
,
0
,
maxR
);
// add
Feature(r);
// Feature[7]: Angle to goal center
addFeature
(
th
);
add
NormFeature
(
th
,
-
2
*
M_PI
,
2
*
M_PI
);
// add
Feature(th);
// Feature[8]: largest open goal angle
addFeature
(
calcLargestGoalAngle
(
wm
,
self_pos
));
addNormFeature
(
calcLargestGoalAngle
(
wm
,
self_pos
),
0
,
M_PI
);
// addFeature(calcLargestGoalAngle(wm, self_pos));
// Feature
[9+
T]: teammate's open angle to goal
// Feature
s [9+T - 9 + 2
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
;
if
(
valid
(
teammate
)
&&
detected_teammates
<
numTeammates
)
{
addFeature
(
calcLargestGoalAngle
(
wm
,
teammate
.
pos
()));
addNormFeature
(
calcLargestGoalAngle
(
wm
,
teammate
.
pos
()),
0
,
M_PI
);
// addFeature(calcLargestGoalAngle(wm, teammate.pos()));
detected_teammates
++
;
}
}
...
...
@@ -90,17 +101,15 @@ const std::vector<float>& HighLevelFeatureExtractor::ExtractFeatures(
// dist to our closest opp
if
(
numOpponents
>
0
)
{
calcClosestOpp
(
wm
,
self_pos
,
th
,
r
);
addFeature
(
r
);
add
NormFeature
(
r
,
0
,
maxR
);
// add
Feature(r);
// teammates dists to closest opps
detected_teammates
=
0
;
for
(
PlayerCont
::
const_iterator
it
=
teammates
.
begin
();
it
!=
teammates
.
end
();
++
it
)
{
const
PlayerObject
&
teammate
=
*
it
;
if
(
valid
(
teammate
)
&&
detected_teammates
<
numTeammates
)
{
//addNormFeature(calcClosestOpp(wm,teammate.pos),0,maxR);
calcClosestOpp
(
wm
,
teammate
.
pos
(),
th
,
r
);
addFeature
(
r
);
//addNormFeature(th,-M_PI,M_PI);
addNormFeature
(
r
,
0
,
maxR
);
// addFeature(r);
detected_teammates
++
;
}
}
...
...
@@ -110,12 +119,13 @@ const std::vector<float>& HighLevelFeatureExtractor::ExtractFeatures(
}
}
// open angle to teammates
//
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
;
if
(
valid
(
teammate
)
&&
detected_teammates
<
numTeammates
)
{
addFeature
(
calcLargestTeammateAngle
(
wm
,
self_pos
,
teammate
.
pos
()));
addNormFeature
(
calcLargestTeammateAngle
(
wm
,
self_pos
,
teammate
.
pos
()),
0
,
M_PI
);
// addFeature(calcLargestTeammateAngle(wm, self_pos, teammate.pos()));
detected_teammates
++
;
}
}
...
...
@@ -124,14 +134,14 @@ const std::vector<float>& HighLevelFeatureExtractor::ExtractFeatures(
addFeature
(
FEAT_INVALID
);
}
//
dist and angle to
teammates
//
Features [9+3T - end]: dist, angle, unum of
teammates
detected_teammates
=
0
;
for
(
PlayerCont
::
const_iterator
it
=
teammates
.
begin
();
it
!=
teammates
.
end
();
++
it
)
{
const
PlayerObject
&
teammate
=
*
it
;
if
(
valid
(
teammate
)
&&
detected_teammates
<
numTeammates
)
{
angleDistToPoint
(
self_pos
,
teammate
.
pos
(),
th
,
r
);
addFeature
(
r
);
addFeature
(
th
);
add
NormFeature
(
r
,
0
,
maxR
);
// add
Feature(r);
add
NormFeature
(
th
,
-
M_PI
,
M_PI
);
// add
Feature(th);
addFeature
(
teammate
.
unum
());
detected_teammates
++
;
}
...
...
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