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
Show 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 @@
#include "bhv_set_play.h"
#include "bhv_set_play_kick_in.h"
#include "bhv_set_play_indirect_free_kick.h"
#include "shoot_generator.h"
#include "bhv_custom_before_kick_off.h"
#include "bhv_strict_check_shoot.h"
...
...
@@ -73,6 +74,7 @@
#include <rcsc/action/body_kick_one_step.h>
#include <rcsc/action/body_pass.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_turn_to_ball_or_scan.h>
#include <rcsc/action/view_synch.h>
...
...
@@ -402,6 +404,14 @@ void Agent::actionImpl() {
close
(
sockfd
);
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
)
{
case
DASH
:
this
->
doDash
(
action
.
arg1
,
action
.
arg2
);
...
...
@@ -419,7 +429,6 @@ void Agent::actionImpl() {
this
->
doMove
();
break
;
case
SHOOT
:
this
->
doShoot
();
break
;
case
PASS
:
this
->
doPass
();
...
...
src/chain_action/shoot_generator.cpp
View file @
5bc12581
...
...
@@ -96,7 +96,7 @@ ShootGenerator::clear()
*/
void
ShootGenerator
::
generate
(
const
WorldModel
&
wm
)
ShootGenerator
::
generate
(
const
WorldModel
&
wm
,
bool
consider_shot_distance
)
{
static
GameTime
s_update_time
(
0
,
0
);
...
...
@@ -124,7 +124,8 @@ ShootGenerator::generate( const WorldModel & wm )
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
dlog
.
addText
(
Logger
::
SHOOT
,
...
...
src/chain_action/shoot_generator.h
View file @
5bc12581
...
...
@@ -140,16 +140,16 @@ public:
static
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
\param agent const pointer to the agent
\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
;
}
...
...
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