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
70a2b0ed
Commit
70a2b0ed
authored
Jun 12, 2015
by
Matthew Hausknecht
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Refactored high level features.
parent
c45a0d4a
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
20 additions
and
7 deletions
+20
-7
src/agent.cpp
src/agent.cpp
+1
-1
src/highlevel_feature_extractor.cpp
src/highlevel_feature_extractor.cpp
+19
-6
No files found.
src/agent.cpp
View file @
70a2b0ed
...
...
@@ -252,7 +252,7 @@ bool Agent::initImpl(CmdLineParser & cmd_parser) {
}
void
Agent
::
startServer
(
int
server_port
)
{
std
::
cout
<<
"Starting Server on Port "
<<
server_port
<<
std
::
endl
;
std
::
cout
<<
"
[Agent Server]
Starting Server on Port "
<<
server_port
<<
std
::
endl
;
struct
sockaddr_in
serv_addr
,
cli_addr
;
sockfd
=
socket
(
AF_INET
,
SOCK_STREAM
,
0
);
if
(
sockfd
<
0
)
{
...
...
src/highlevel_feature_extractor.cpp
View file @
70a2b0ed
...
...
@@ -41,9 +41,15 @@ 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
();
if
(
playingOffense
)
{
// Feature[0]: Xpostion
addNormFeature
(
self_pos
.
x
,
-
tolerance_x
,
SP
.
pitchHalfLength
()
+
tolerance_x
);
}
else
{
addNormFeature
(
self_pos
.
x
,
-
SP
.
pitchHalfLength
()
-
tolerance_x
,
tolerance_x
);
}
// Feature[1]: YPosition
addNormFeature
(
self_pos
.
y
,
-
SP
.
pitchHalfWidth
()
-
tolerance_y
,
SP
.
pitchHalfWidth
()
+
tolerance_y
);
// Feature[2]: Self Angle
addNormFeature
(
self_ang
,
-
2
*
M_PI
,
2
*
M_PI
);
float
r
;
...
...
@@ -51,20 +57,27 @@ const std::vector<float>& HighLevelFeatureExtractor::ExtractFeatures(
// features about the ball
Vector2D
ball_pos
=
wm
.
ball
().
pos
();
angleDistToPoint
(
self_pos
,
ball_pos
,
th
,
r
);
// Feature[3]: Dist to ball
addNormFeature
(
r
,
0
,
maxR
);
// Feature[4]: Ang to ball
addNormFeature
(
th
,
-
2
*
M_PI
,
2
*
M_PI
);
// Feature[5]: Able to kick
addNormFeature
(
self
.
isKickable
(),
false
,
true
);
// features about distance to goal center
Vector2D
goalCenter
(
SP
.
pitchHalfLength
(),
0
);
if
(
!
playingOffense
)
{
goalCenter
.
assign
(
-
SP
.
pitchHalfLength
(),
0
);
}
angleDistToPoint
(
self_pos
,
goalCenter
,
th
,
r
);
// Feature[6]: Goal Center Distance
addNormFeature
(
r
,
0
,
maxR
);
// Distance to goal center
// Feature[7]: Angle to goal center
addNormFeature
(
th
,
-
2
*
M_PI
,
2
*
M_PI
);
// Ang to goal center
// features about our open angle to goal
// Feature[8]: largest open goal angle
addNormFeature
(
calcLargestGoalAngle
(
wm
,
self_pos
),
0
,
M_PI
);
//std::cout << "goal angle: " << RAD_T_DEG * features[ind-1] << std::endl;
// teammate's open angle to goal
//
Feature [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
;
...
...
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