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
76209cdb
Commit
76209cdb
authored
Jul 12, 2017
by
drallensmith
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Trying to deal with 'Violated Feature Bounds' errors for self, ball position - match documentation
parent
5c4bd316
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
28 additions
and
15 deletions
+28
-15
src/highlevel_feature_extractor.cpp
src/highlevel_feature_extractor.cpp
+28
-15
No files found.
src/highlevel_feature_extractor.cpp
View file @
76209cdb
...
@@ -36,32 +36,45 @@ const std::vector<float>& HighLevelFeatureExtractor::ExtractFeatures(
...
@@ -36,32 +36,45 @@ const std::vector<float>& HighLevelFeatureExtractor::ExtractFeatures(
// Allow the agent to go 10% over the playfield in any direction
// Allow the agent to go 10% over the playfield in any direction
float
tolerance_x
=
.1
*
SP
.
pitchHalfLength
();
float
tolerance_x
=
.1
*
SP
.
pitchHalfLength
();
float
tolerance_y
=
.1
*
SP
.
pitchHalfWidth
();
float
tolerance_y
=
.1
*
SP
.
pitchHalfWidth
();
// Feature[0]: X-postion
// figure up min, max x, y
float
min_x
=
0
;
// Depends on offense vs defense
float
max_x
=
0
;
if
(
playingOffense
)
{
if
(
playingOffense
)
{
addNormFeature
(
self_pos
.
x
,
-
tolerance_x
,
SP
.
pitchHalfLength
()
+
tolerance_x
);
min_x
=
-
tolerance_x
;
max_x
=
SP
.
pitchHalfLength
()
+
tolerance_x
;
}
else
{
}
else
{
addNormFeature
(
self_pos
.
x
,
-
SP
.
pitchHalfLength
()
-
tolerance_x
,
tolerance_x
);
min_x
=
-
SP
.
pitchHalfLength
()
-
tolerance_x
;
max_x
=
tolerance_x
;
}
float
min_y
=
-
SP
.
pitchHalfWidth
()
-
tolerance_y
;
float
max_y
=
SP
.
pitchHalfWidth
()
+
tolerance_y
;
// Feature[0]: X-postion
// Feature[1]: Y-position
if
(
valid
(
self
))
{
addNormFeature
(
self_pos
.
x
,
min_x
,
max_x
);
addNormFeature
(
self_pos
.
y
,
min_y
,
max_y
);
}
else
{
addFeature
(
FEAT_INVALID
);
addFeature
(
FEAT_INVALID
);
}
}
// Feature[1]: Y-Position
addNormFeature
(
self_pos
.
y
,
-
SP
.
pitchHalfWidth
()
-
tolerance_y
,
SP
.
pitchHalfWidth
()
+
tolerance_y
);
// Feature[2]: Self Angle
// Feature[2]: Self Angle
addNormFeature
(
self_ang
,
-
M_PI
,
M_PI
);
addNormFeature
(
self_ang
,
-
M_PI
,
M_PI
);
// Check for validity?
float
r
;
float
r
;
float
th
;
float
th
;
// Features about the ball
// Features about the ball
Vector2D
ball_pos
=
wm
.
ball
().
pos
();
const
BallObject
&
ball
=
wm
.
ball
();
if
(
ball
.
rposValid
())
{
Vector2D
ball_pos
=
ball
.
pos
();
angleDistToPoint
(
self_pos
,
ball_pos
,
th
,
r
);
angleDistToPoint
(
self_pos
,
ball_pos
,
th
,
r
);
// Feature[3] and [4]: (x,y) postition of the ball
// Feature[3] and [4]: (x,y) postition of the ball
if
(
playingOffense
)
{
addNormFeature
(
ball_pos
.
x
,
min_x
,
max_x
);
addNormFeature
(
ball_pos
.
x
,
-
tolerance_x
,
SP
.
pitchHalfLength
()
+
tolerance_x
);
addNormFeature
(
ball_pos
.
y
,
min_y
,
max_y
);
}
else
{
}
else
{
addNormFeature
(
ball_pos
.
x
,
-
SP
.
pitchHalfLength
()
-
tolerance_x
,
tolerance_x
);
addFeature
(
FEAT_INVALID
);
addFeature
(
FEAT_INVALID
);
}
}
addNormFeature
(
ball_pos
.
y
,
-
SP
.
pitchHalfWidth
()
-
tolerance_y
,
SP
.
pitchHalfWidth
()
+
tolerance_y
);
// Feature[5]: Able to kick
// Feature[5]: Able to kick
addNormFeature
(
self
.
isKickable
(),
false
,
true
);
addNormFeature
(
self
.
isKickable
(),
false
,
true
);
...
...
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