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
db768bb0
You need to sign in or sign up before continuing.
Commit
db768bb0
authored
Aug 13, 2017
by
drallensmith
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixes for ball localization, feedback
parent
beceb50a
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
54 additions
and
49 deletions
+54
-49
src/agent.cpp
src/agent.cpp
+43
-35
src/bhv_basic_move.cpp
src/bhv_basic_move.cpp
+11
-14
No files found.
src/agent.cpp
View file @
db768bb0
...
@@ -254,11 +254,19 @@ void Agent::actionImpl() {
...
@@ -254,11 +254,19 @@ void Agent::actionImpl() {
// For now let's not worry about turning the neck or setting the vision.
// For now let's not worry about turning the neck or setting the vision.
// But do the settings now, so that doesn't override any set by the actions below.
// But do the settings now, so that doesn't override any set by the actions below.
// TODO: Add setViewActionDefault, setNeckActionDefault to librcsc that only set if not already set.
// TODO: Add setViewActionDefault, setNeckActionDefault to librcsc that only set if not already set.
this
->
setViewAction
(
new
View_Tactical
());
this
->
setNeckAction
(
new
Neck_TurnToBallOrScan
());
const
WorldModel
&
wm
=
this
->
world
();
const
WorldModel
&
wm
=
this
->
world
();
this
->
setViewAction
(
new
View_Tactical
());
if
(
wm
.
ball
().
posValid
())
{
this
->
setNeckAction
(
new
Neck_TurnToBallOrScan
());
// if not ball().posValid(), requests possibly-invalid queuedNextBallPos()
}
else
{
this
->
setNeckAction
(
new
Neck_ScanField
());
// equivalent to Neck_TurnToBall()
}
switch
(
requested_action
)
{
switch
(
requested_action
)
{
case
DASH
:
case
DASH
:
last_action_status
=
this
->
doDash
(
params
[
0
],
params
[
1
]);
last_action_status
=
this
->
doDash
(
params
[
0
],
params
[
1
]);
...
@@ -627,7 +635,11 @@ Agent::doPreprocess()
...
@@ -627,7 +635,11 @@ Agent::doPreprocess()
wm
.
self
().
tackleExpires
()
);
wm
.
self
().
tackleExpires
()
);
// face neck to ball
// face neck to ball
this
->
setViewAction
(
new
View_Tactical
()
);
this
->
setViewAction
(
new
View_Tactical
()
);
this
->
setNeckAction
(
new
Neck_TurnToBallOrScan
()
);
if
(
wm
.
ball
().
posValid
())
{
this
->
setNeckAction
(
new
Neck_TurnToBallOrScan
()
);
}
else
{
this
->
setNeckAction
(
new
Neck_TurnToBall
()
);
}
return
true
;
return
true
;
}
}
...
@@ -652,8 +664,7 @@ Agent::doPreprocess()
...
@@ -652,8 +664,7 @@ Agent::doPreprocess()
{
{
dlog
.
addText
(
Logger
::
TEAM
,
dlog
.
addText
(
Logger
::
TEAM
,
__FILE__
": invalid my pos"
);
__FILE__
": invalid my pos"
);
Bhv_Emergency
().
execute
(
this
);
// includes change view
return
Bhv_Emergency
().
execute
(
this
);
// includes change view
return
true
;
}
}
//
//
...
@@ -662,15 +673,14 @@ Agent::doPreprocess()
...
@@ -662,15 +673,14 @@ Agent::doPreprocess()
const
int
count_thr
=
(
wm
.
self
().
goalie
()
const
int
count_thr
=
(
wm
.
self
().
goalie
()
?
10
?
10
:
5
);
:
5
);
if
(
wm
.
ball
().
posCount
()
>
count_thr
if
(
wm
.
ball
().
posCount
()
<
count_thr
||
(
wm
.
gameMode
().
type
()
!=
GameMode
::
PlayOn
||
(
wm
.
gameMode
().
type
()
!=
GameMode
::
PlayOn
&&
wm
.
ball
().
seenPosCount
()
>
count_thr
+
10
)
)
&&
wm
.
ball
().
seenPosCount
()
<
count_thr
+
10
)
)
{
{
dlog
.
addText
(
Logger
::
TEAM
,
dlog
.
addText
(
Logger
::
TEAM
,
__FILE__
": search ball"
);
__FILE__
": search ball"
);
this
->
setViewAction
(
new
View_Tactical
()
);
this
->
setViewAction
(
new
View_Tactical
()
);
Bhv_NeckBodyToBall
().
execute
(
this
);
return
Bhv_NeckBodyToBall
().
execute
(
this
);
return
true
;
}
}
//
//
...
@@ -743,8 +753,7 @@ Agent::doReorient()
...
@@ -743,8 +753,7 @@ Agent::doReorient()
__FILE__
": tackle wait. expires= %d"
,
__FILE__
": tackle wait. expires= %d"
,
wm
.
self
().
tackleExpires
()
);
wm
.
self
().
tackleExpires
()
);
Bhv_Emergency
().
execute
(
this
);
// includes change view
return
Bhv_Emergency
().
execute
(
this
);
// includes change view
return
true
;
}
}
//
//
...
@@ -773,8 +782,7 @@ Agent::doReorient()
...
@@ -773,8 +782,7 @@ Agent::doReorient()
dlog
.
addText
(
Logger
::
TEAM
,
dlog
.
addText
(
Logger
::
TEAM
,
__FILE__
": invalid my vel"
);
__FILE__
": invalid my vel"
);
}
}
Bhv_Emergency
().
execute
(
this
);
// includes change view
return
Bhv_Emergency
().
execute
(
this
);
// includes change view
return
true
;
}
}
//
//
...
@@ -786,20 +794,14 @@ Agent::doReorient()
...
@@ -786,20 +794,14 @@ Agent::doReorient()
//
//
// ball localization error
// ball localization error
//
//
const
int
count_thr
=
(
wm
.
self
().
goalie
()
?
10
:
5
);
if
(
wm
.
ball
().
posCount
()
>
count_thr
||
(
wm
.
gameMode
().
type
()
!=
GameMode
::
PlayOn
&&
wm
.
ball
().
seenPosCount
()
>
count_thr
+
10
)
)
{
dlog
.
addText
(
Logger
::
TEAM
,
__FILE__
": search ball"
);
Bhv_NeckBodyToBall
().
execute
(
this
);
const
BallObject
&
ball
=
wm
.
ball
();
return
true
;
if
(
!
(
ball
.
posValid
()
&&
ball
.
velValid
()
))
{
}
dlog
.
addText
(
Logger
::
TEAM
,
__FILE__
": search ball"
);
return
Bhv_NeckBodyToBall
().
execute
(
this
);
}
//
//
// check pass message
// check pass message
...
@@ -809,13 +811,20 @@ Agent::doReorient()
...
@@ -809,13 +811,20 @@ Agent::doReorient()
return
true
;
return
true
;
}
}
const
BallObject
&
ball
=
wm
.
ball
();
//
if
(
!
(
ball
.
rposValid
()
&&
ball
.
velValid
()
))
{
// ball localization error
dlog
.
addText
(
Logger
::
TEAM
,
//
__FILE__
": search ball"
);
const
int
count_thr
=
(
wm
.
self
().
goalie
()
?
10
:
5
);
if
(
wm
.
ball
().
posCount
()
<
count_thr
||
(
wm
.
gameMode
().
type
()
!=
GameMode
::
PlayOn
&&
wm
.
ball
().
seenPosCount
()
<
count_thr
+
10
)
)
{
dlog
.
addText
(
Logger
::
TEAM
,
__FILE__
": search ball"
);
Bhv_NeckBodyToBall
().
execute
(
this
);
return
Bhv_NeckBodyToBall
().
execute
(
this
);
return
true
;
}
}
//
//
...
@@ -902,7 +911,6 @@ Agent::doPassTo(int receiver)
...
@@ -902,7 +911,6 @@ Agent::doPassTo(int receiver)
bool
bool
Agent
::
doDribble
()
Agent
::
doDribble
()
{
{
bool
success
=
false
;
Strategy
::
instance
().
update
(
world
()
);
Strategy
::
instance
().
update
(
world
()
);
M_field_evaluator
=
createFieldEvaluator
();
M_field_evaluator
=
createFieldEvaluator
();
CompositeActionGenerator
*
g
=
new
CompositeActionGenerator
();
CompositeActionGenerator
*
g
=
new
CompositeActionGenerator
();
...
@@ -998,7 +1006,7 @@ bool Agent::doReduceAngleToGoal() {
...
@@ -998,7 +1006,7 @@ bool Agent::doReduceAngleToGoal() {
const
PlayerPtrCont
::
const_iterator
o_end
=
wm
.
opponentsFromSelf
().
end
();
const
PlayerPtrCont
::
const_iterator
o_end
=
wm
.
opponentsFromSelf
().
end
();
const
BallObject
&
ball
=
wm
.
ball
();
const
BallObject
&
ball
=
wm
.
ball
();
if
(
!
ball
.
r
posValid
())
{
if
(
!
ball
.
posValid
())
{
return
false
;
return
false
;
}
}
...
@@ -1087,7 +1095,7 @@ bool Agent::doDefendGoal() {
...
@@ -1087,7 +1095,7 @@ bool Agent::doDefendGoal() {
Vector2D
goal_pos1
(
-
ServerParam
::
i
().
pitchHalfLength
()
+
ServerParam
::
i
().
goalAreaLength
(),
ServerParam
::
i
().
goalHalfWidth
()
);
Vector2D
goal_pos1
(
-
ServerParam
::
i
().
pitchHalfLength
()
+
ServerParam
::
i
().
goalAreaLength
(),
ServerParam
::
i
().
goalHalfWidth
()
);
Vector2D
goal_pos2
(
-
ServerParam
::
i
().
pitchHalfLength
()
+
ServerParam
::
i
().
goalAreaLength
(),
-
ServerParam
::
i
().
goalHalfWidth
()
);
Vector2D
goal_pos2
(
-
ServerParam
::
i
().
pitchHalfLength
()
+
ServerParam
::
i
().
goalAreaLength
(),
-
ServerParam
::
i
().
goalHalfWidth
()
);
const
BallObject
&
ball
=
wm
.
ball
();
const
BallObject
&
ball
=
wm
.
ball
();
if
(
!
ball
.
r
posValid
())
{
if
(
!
ball
.
posValid
())
{
return
false
;
return
false
;
}
}
...
@@ -1115,7 +1123,7 @@ bool Agent::doDefendGoal() {
...
@@ -1115,7 +1123,7 @@ bool Agent::doDefendGoal() {
bool
Agent
::
doGoToBall
()
{
bool
Agent
::
doGoToBall
()
{
const
WorldModel
&
wm
=
this
->
world
();
const
WorldModel
&
wm
=
this
->
world
();
const
BallObject
&
ball
=
wm
.
ball
();
const
BallObject
&
ball
=
wm
.
ball
();
if
(
!
ball
.
r
posValid
())
{
if
(
!
ball
.
posValid
())
{
return
false
;
return
false
;
}
}
return
Body_GoToPoint
(
ball
.
pos
(),
0.25
,
ServerParam
::
i
().
maxDashPower
()).
execute
(
this
);
return
Body_GoToPoint
(
ball
.
pos
(),
0.25
,
ServerParam
::
i
().
maxDashPower
()).
execute
(
this
);
...
...
src/bhv_basic_move.cpp
View file @
db768bb0
...
@@ -60,7 +60,6 @@ Bhv_BasicMove::execute( PlayerAgent * agent )
...
@@ -60,7 +60,6 @@ Bhv_BasicMove::execute( PlayerAgent * agent )
{
{
dlog
.
addText
(
Logger
::
TEAM
,
dlog
.
addText
(
Logger
::
TEAM
,
__FILE__
": Bhv_BasicMove"
);
__FILE__
": Bhv_BasicMove"
);
bool
success
=
false
;
//-----------------------------------------------
//-----------------------------------------------
// tackle
// tackle
...
@@ -85,7 +84,7 @@ Bhv_BasicMove::execute( PlayerAgent * agent )
...
@@ -85,7 +84,7 @@ Bhv_BasicMove::execute( PlayerAgent * agent )
{
{
dlog
.
addText
(
Logger
::
TEAM
,
dlog
.
addText
(
Logger
::
TEAM
,
__FILE__
": intercept"
);
__FILE__
": intercept"
);
success
=
Body_Intercept
().
execute
(
agent
);
bool
success
=
Body_Intercept
().
execute
(
agent
);
agent
->
setNeckAction
(
new
Neck_OffensiveInterceptNeck
()
);
agent
->
setNeckAction
(
new
Neck_OffensiveInterceptNeck
()
);
return
success
;
return
success
;
}
}
...
@@ -107,10 +106,9 @@ Bhv_BasicMove::execute( PlayerAgent * agent )
...
@@ -107,10 +106,9 @@ Bhv_BasicMove::execute( PlayerAgent * agent )
agent
->
debugClient
().
setTarget
(
target_point
);
agent
->
debugClient
().
setTarget
(
target_point
);
agent
->
debugClient
().
addCircle
(
target_point
,
dist_thr
);
agent
->
debugClient
().
addCircle
(
target_point
,
dist_thr
);
if
(
ball
.
rposValid
()
||
wm
.
self
().
collidesWithPost
())
{
bool
success
=
false
;
if
(
ball
.
posValid
()
||
wm
.
self
().
collidesWithPost
())
{
success
=
true
;
success
=
true
;
}
else
{
success
=
false
;
}
}
if
(
Body_GoToPoint
(
target_point
,
dist_thr
,
dash_power
if
(
Body_GoToPoint
(
target_point
,
dist_thr
,
dash_power
...
@@ -122,16 +120,15 @@ Bhv_BasicMove::execute( PlayerAgent * agent )
...
@@ -122,16 +120,15 @@ Bhv_BasicMove::execute( PlayerAgent * agent )
success
=
false
;
success
=
false
;
}
}
if
(
wm
.
existKickableOpponent
()
&&
if
(
wm
.
existKickableOpponent
()
ball
.
rposValid
()
&&
ball
.
distFromSelf
()
<
18.0
)
{
&&
wm
.
ball
().
distFromSelf
()
<
18.0
)
agent
->
setNeckAction
(
new
Neck_TurnToBall
()
);
{
}
else
if
(
ball
.
posValid
()
)
{
agent
->
setNeckAction
(
new
Neck_TurnToBall
()
);
agent
->
setNeckAction
(
new
Neck_TurnToBallOrScan
()
);
}
}
else
{
else
agent
->
setNeckAction
(
new
Neck_TurnToBall
()
);
{
agent
->
setNeckAction
(
new
Neck_TurnToBallOrScan
()
);
}
}
return
success
;
return
success
;
}
}
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