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
9ba10917
Commit
9ba10917
authored
Nov 12, 2016
by
Siddharth Aravindan
Committed by
asiddharth
Nov 12, 2016
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Incorporated code review changes
parent
08411cb1
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
20 additions
and
79 deletions
+20
-79
src/agent.cpp
src/agent.cpp
+1
-72
src/common.hpp
src/common.hpp
+4
-4
src/highlevel_feature_extractor.cpp
src/highlevel_feature_extractor.cpp
+15
-3
No files found.
src/agent.cpp
View file @
9ba10917
...
@@ -833,46 +833,7 @@ bool Agent::doMarkPlayer(int unum) {
...
@@ -833,46 +833,7 @@ bool Agent::doMarkPlayer(int unum) {
return
true
;
return
true
;
}
}
/*!
* This Action marks the player which is "nearindex" nearest to the ball.
*/
bool
Agent
::
doMarkPlayerNearIndex
(
int
nearIndex
)
{
const
WorldModel
&
wm
=
this
->
world
();
Vector2D
kicker_pos
=
Vector2D
::
INVALIDATED
;
Vector2D
player_pos
=
Vector2D
::
INVALIDATED
;
const
PlayerPtrCont
::
const_iterator
o_end
=
wm
.
opponentsFromSelf
().
end
();
int
count
=
0
;
for
(
PlayerPtrCont
::
const_iterator
it
=
wm
.
opponentsFromSelf
().
begin
();
it
!=
o_end
;
++
it
)
{
if
(
(
*
it
)
->
distFromBall
()
<
5
)
{
kicker_pos
=
(
*
it
)
->
pos
();
}
}
if
(
nearIndex
>=
0
&&
nearIndex
<=
wm
.
opponentsFromBall
().
size
())
{
player_pos
=
wm
.
opponentsFromBall
().
at
(
nearIndex
-
1
)
->
pos
();
}
if
(
!
player_pos
.
isValid
())
{
//"nearIndex Player Not Found
return
false
;
}
if
(
!
kicker_pos
.
isValid
())
{
//Kicker not found
return
false
;
}
if
(
kicker_pos
.
equals
(
player_pos
))
{
//nearIndex Player to be marked is kicker
return
false
;
}
double
x
=
player_pos
.
x
+
(
kicker_pos
.
x
-
player_pos
.
x
)
*
0.1
;
double
y
=
player_pos
.
y
+
(
kicker_pos
.
y
-
player_pos
.
y
)
*
0.1
;
Body_GoToPoint
(
Vector2D
(
x
,
y
),
0.25
,
ServerParam
::
i
().
maxDashPower
()).
execute
(
this
);
return
true
;
}
/*-------------------------------------------------------------------*/
/*-------------------------------------------------------------------*/
/*!
/*!
*
*
* This action cuts off the angle between the shooter and the goal the players always move to a dynamic line in between the kicker and the goal.
* This action cuts off the angle between the shooter and the goal the players always move to a dynamic line in between the kicker and the goal.
...
@@ -996,38 +957,6 @@ bool Agent::doGoToBall() {
...
@@ -996,38 +957,6 @@ bool Agent::doGoToBall() {
/*-------------------------------------------------------------------*/
/*-------------------------------------------------------------------*/
/*!
Used for 1v1 .
High level action MOVE is taken whenever the agent does not have the ball.
Medium level action DRIBBLE_TO is taken whenever the agent has to turn by a large amount to get the correct angle to shoot at the goal.
High level action SHOOT is used to shoot it to the goal
This is an example action and is not used.
*/
bool
Agent
::
doNewAction1
()
{
const
WorldModel
&
wm
=
this
->
world
();
if
(
!
wm
.
self
().
isKickable
()
)
{
this
->
doMove
();
return
true
;
}
else
{
Vector2D
goal_pos
(
-
ServerParam
::
i
().
pitchHalfLength
(),
0.0
);
Vector2D
self_pos
=
wm
.
self
().
pos
();
Vector2D
dir
(
self_pos
.
x
-
goal_pos
.
x
,
self_pos
.
y
-
goal_pos
.
y
);
AngleDeg
angle
=
wm
.
self
().
vel
().
th
();
double
angle_threshold
=
10
;
double
angle_diff
=
(
dir
.
th
()
-
angle
).
degree
();
if
(
std
::
fabs
(
angle_diff
)
>
angle_threshold
&&
goal_pos
.
dist
(
self_pos
)
>
20
)
{
double
x
=
self_pos
.
x
+
0.1
*
(
goal_pos
.
x
-
self_pos
.
x
);
double
y
=
self_pos
.
y
+
0.1
*
(
goal_pos
.
y
-
self_pos
.
y
);
Body_Dribble
(
Vector2D
(
x
,
y
),
1.0
,
ServerParam
::
i
().
maxDashPower
(),
2
).
execute
(
this
);
}
else
{
this
->
doSmartKick
();
}
return
true
;
}
}
/*-------------------------------------------------------------------*/
/*!
/*!
*/
*/
...
...
src/common.hpp
View file @
9ba10917
src/highlevel_feature_extractor.cpp
View file @
9ba10917
...
@@ -56,7 +56,11 @@ const std::vector<float>& HighLevelFeatureExtractor::ExtractFeatures(
...
@@ -56,7 +56,11 @@ const std::vector<float>& HighLevelFeatureExtractor::ExtractFeatures(
Vector2D
ball_pos
=
wm
.
ball
().
pos
();
Vector2D
ball_pos
=
wm
.
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
,
-
tolerance_x
,
SP
.
pitchHalfLength
()
+
tolerance_x
);
}
else
{
addNormFeature
(
ball_pos
.
x
,
-
SP
.
pitchHalfLength
()
-
tolerance_x
,
tolerance_x
);
addNormFeature
(
ball_pos
.
x
,
-
SP
.
pitchHalfLength
()
-
tolerance_x
,
tolerance_x
);
}
addNormFeature
(
ball_pos
.
y
,
-
SP
.
pitchHalfWidth
()
-
tolerance_y
,
SP
.
pitchHalfWidth
()
+
tolerance_y
);
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
);
...
@@ -135,7 +139,11 @@ const std::vector<float>& HighLevelFeatureExtractor::ExtractFeatures(
...
@@ -135,7 +139,11 @@ const std::vector<float>& HighLevelFeatureExtractor::ExtractFeatures(
for
(
PlayerCont
::
const_iterator
it
=
teammates
.
begin
();
it
!=
teammates
.
end
();
++
it
)
{
for
(
PlayerCont
::
const_iterator
it
=
teammates
.
begin
();
it
!=
teammates
.
end
();
++
it
)
{
const
PlayerObject
&
teammate
=
*
it
;
const
PlayerObject
&
teammate
=
*
it
;
if
(
valid
(
teammate
)
&&
detected_teammates
<
numTeammates
)
{
if
(
valid
(
teammate
)
&&
detected_teammates
<
numTeammates
)
{
addNormFeature
(
teammate
.
pos
().
x
,
-
tolerance_x
-
SP
.
pitchHalfLength
(),
tolerance_x
);
if
(
playingOffense
)
{
addNormFeature
(
teammate
.
pos
().
x
,
-
tolerance_x
,
SP
.
pitchHalfLength
()
+
tolerance_x
);
}
else
{
addNormFeature
(
teammate
.
pos
().
x
,
-
SP
.
pitchHalfLength
()
-
tolerance_x
,
tolerance_x
);
}
addNormFeature
(
teammate
.
pos
().
y
,
-
tolerance_y
-
SP
.
pitchHalfWidth
(),
SP
.
pitchHalfWidth
()
+
tolerance_y
);
addNormFeature
(
teammate
.
pos
().
y
,
-
tolerance_y
-
SP
.
pitchHalfWidth
(),
SP
.
pitchHalfWidth
()
+
tolerance_y
);
addFeature
(
teammate
.
unum
());
addFeature
(
teammate
.
unum
());
detected_teammates
++
;
detected_teammates
++
;
...
@@ -153,7 +161,11 @@ const std::vector<float>& HighLevelFeatureExtractor::ExtractFeatures(
...
@@ -153,7 +161,11 @@ const std::vector<float>& HighLevelFeatureExtractor::ExtractFeatures(
for
(
PlayerCont
::
const_iterator
it
=
opponents
.
begin
();
it
!=
opponents
.
end
();
++
it
)
{
for
(
PlayerCont
::
const_iterator
it
=
opponents
.
begin
();
it
!=
opponents
.
end
();
++
it
)
{
const
PlayerObject
&
opponent
=
*
it
;
const
PlayerObject
&
opponent
=
*
it
;
if
(
valid
(
opponent
)
&&
detected_opponents
<
numOpponents
)
{
if
(
valid
(
opponent
)
&&
detected_opponents
<
numOpponents
)
{
addNormFeature
(
opponent
.
pos
().
x
,
-
tolerance_x
-
SP
.
pitchHalfLength
(),
tolerance_x
);
if
(
playingOffense
)
{
addNormFeature
(
opponent
.
pos
().
x
,
-
tolerance_x
,
SP
.
pitchHalfLength
()
+
tolerance_x
);
}
else
{
addNormFeature
(
opponent
.
pos
().
x
,
-
SP
.
pitchHalfLength
()
-
tolerance_x
,
tolerance_x
);
}
addNormFeature
(
opponent
.
pos
().
y
,
-
tolerance_y
-
SP
.
pitchHalfWidth
(),
SP
.
pitchHalfWidth
()
+
tolerance_y
);
addNormFeature
(
opponent
.
pos
().
y
,
-
tolerance_y
-
SP
.
pitchHalfWidth
(),
SP
.
pitchHalfWidth
()
+
tolerance_y
);
addFeature
(
opponent
.
unum
());
addFeature
(
opponent
.
unum
());
detected_opponents
++
;
detected_opponents
++
;
...
...
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