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
5bc12581
Commit
5bc12581
authored
Aug 13, 2015
by
Matthew Hausknecht
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Parameterized distance restrictions on shoot.
parent
94beac7f
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
19 additions
and
9 deletions
+19
-9
src/agent.cpp
src/agent.cpp
+10
-1
src/chain_action/shoot_generator.cpp
src/chain_action/shoot_generator.cpp
+6
-5
src/chain_action/shoot_generator.h
src/chain_action/shoot_generator.h
+3
-3
No files found.
src/agent.cpp
View file @
5bc12581
...
@@ -46,6 +46,7 @@
...
@@ -46,6 +46,7 @@
#include "bhv_set_play.h"
#include "bhv_set_play.h"
#include "bhv_set_play_kick_in.h"
#include "bhv_set_play_kick_in.h"
#include "bhv_set_play_indirect_free_kick.h"
#include "bhv_set_play_indirect_free_kick.h"
#include "shoot_generator.h"
#include "bhv_custom_before_kick_off.h"
#include "bhv_custom_before_kick_off.h"
#include "bhv_strict_check_shoot.h"
#include "bhv_strict_check_shoot.h"
...
@@ -73,6 +74,7 @@
...
@@ -73,6 +74,7 @@
#include <rcsc/action/body_kick_one_step.h>
#include <rcsc/action/body_kick_one_step.h>
#include <rcsc/action/body_pass.h>
#include <rcsc/action/body_pass.h>
#include <rcsc/action/body_dribble.h>
#include <rcsc/action/body_dribble.h>
#include <rcsc/action/body_smart_kick.h>
#include <rcsc/action/neck_scan_field.h>
#include <rcsc/action/neck_scan_field.h>
#include <rcsc/action/neck_turn_to_ball_or_scan.h>
#include <rcsc/action/neck_turn_to_ball_or_scan.h>
#include <rcsc/action/view_synch.h>
#include <rcsc/action/view_synch.h>
...
@@ -402,6 +404,14 @@ void Agent::actionImpl() {
...
@@ -402,6 +404,14 @@ void Agent::actionImpl() {
close
(
sockfd
);
close
(
sockfd
);
exit
(
1
);
exit
(
1
);
}
}
if
(
action
.
action
==
SHOOT
)
{
const
ShootGenerator
::
Container
&
cont
=
ShootGenerator
::
instance
().
courses
(
this
->
world
(),
false
);
ShootGenerator
::
Container
::
const_iterator
best_shoot
=
std
::
min_element
(
cont
.
begin
(),
cont
.
end
(),
ShootGenerator
::
ScoreCmp
());
Body_SmartKick
(
best_shoot
->
target_point_
,
best_shoot
->
first_ball_speed_
,
best_shoot
->
first_ball_speed_
*
0.99
,
3
).
execute
(
this
);
}
switch
(
action
.
action
)
{
switch
(
action
.
action
)
{
case
DASH
:
case
DASH
:
this
->
doDash
(
action
.
arg1
,
action
.
arg2
);
this
->
doDash
(
action
.
arg1
,
action
.
arg2
);
...
@@ -419,7 +429,6 @@ void Agent::actionImpl() {
...
@@ -419,7 +429,6 @@ void Agent::actionImpl() {
this
->
doMove
();
this
->
doMove
();
break
;
break
;
case
SHOOT
:
case
SHOOT
:
this
->
doShoot
();
break
;
break
;
case
PASS
:
case
PASS
:
this
->
doPass
();
this
->
doPass
();
...
...
src/chain_action/shoot_generator.cpp
View file @
5bc12581
...
@@ -96,7 +96,7 @@ ShootGenerator::clear()
...
@@ -96,7 +96,7 @@ ShootGenerator::clear()
*/
*/
void
void
ShootGenerator
::
generate
(
const
WorldModel
&
wm
)
ShootGenerator
::
generate
(
const
WorldModel
&
wm
,
bool
consider_shot_distance
)
{
{
static
GameTime
s_update_time
(
0
,
0
);
static
GameTime
s_update_time
(
0
,
0
);
...
@@ -124,13 +124,14 @@ ShootGenerator::generate( const WorldModel & wm )
...
@@ -124,13 +124,14 @@ ShootGenerator::generate( const WorldModel & wm )
const
ServerParam
&
SP
=
ServerParam
::
i
();
const
ServerParam
&
SP
=
ServerParam
::
i
();
if
(
wm
.
self
().
pos
().
dist2
(
SP
.
theirTeamGoalPos
()
)
>
std
::
pow
(
30.0
,
2
)
)
if
(
consider_shot_distance
&&
wm
.
self
().
pos
().
dist2
(
SP
.
theirTeamGoalPos
()
)
>
std
::
pow
(
30.0
,
2
)
)
{
{
#ifdef DEBUG_PRINT
#ifdef DEBUG_PRINT
dlog
.
addText
(
Logger
::
SHOOT
,
dlog
.
addText
(
Logger
::
SHOOT
,
__FILE__
": over shootable distance"
);
__FILE__
": over shootable distance"
);
#endif
#endif
return
;
return
;
}
}
M_first_ball_pos
=
(
wm
.
self
().
isKickable
()
M_first_ball_pos
=
(
wm
.
self
().
isKickable
()
...
...
src/chain_action/shoot_generator.h
View file @
5bc12581
...
@@ -140,16 +140,16 @@ public:
...
@@ -140,16 +140,16 @@ public:
static
static
ShootGenerator
&
instance
();
ShootGenerator
&
instance
();
void
generate
(
const
rcsc
::
WorldModel
&
wm
);
void
generate
(
const
rcsc
::
WorldModel
&
wm
,
bool
consider_shot_distance
=
true
);
/*!
/*!
\brief calculate the shoot and return the container
\brief calculate the shoot and return the container
\param agent const pointer to the agent
\param agent const pointer to the agent
\return const reference to the shoot container
\return const reference to the shoot container
*/
*/
const
Container
&
courses
(
const
rcsc
::
WorldModel
&
wm
)
const
Container
&
courses
(
const
rcsc
::
WorldModel
&
wm
,
bool
consider_shot_distance
=
true
)
{
{
generate
(
wm
);
generate
(
wm
,
consider_shot_distance
);
return
M_courses
;
return
M_courses
;
}
}
...
...
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