/*
Copyright (c) 2000-2003, Jelle Kok, University of Amsterdam
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
3. Neither the name of the University of Amsterdam nor the names of its
contributors may be used to endorse or promote products derived from this
software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
/*! \file BasicPlayer.cpp
<pre>
<b>File:</b> BasicPlayer.cpp
<b>Project:</b> Robocup Soccer Simulation Team: UvA Trilearn
<b>Authors:</b> Jelle Kok
<b>Created:</b> 10/12/2000
<b>Last Revision:</b> $ID$
<b>Contents:</b> This file contains the class declaration for the
BasicPlayer. The BasicPlayer is the class where the
available skills for the agent are defined.
<hr size=2>
<h2><b>Changes</b></h2>
<b>Date</b> <b>Author</b> <b>Comment</b>:
10/12/2000 Jelle Kok Initial version created
</pre>
*/
#include "BasicPlayer.h"
#include "Parse.h" // parseFirstInt
#include <iostream>
using namespace std ;
bool dcase4_1=true,dcase4_2=true;
int cyback;
/********************** LOW-LEVEL SKILLS *************************************/
/*! This skill enables an agent to align his neck with his body. It returns a
turn neck command that takes the angle of the agent's body relative to his
neck as its only argument.
\return SoccerCommand turn_neck command that aligns neck with body */
SoccerCommand BasicPlayer::alignNeckWithBody( )
{
return SoccerCommand ( CMD_TURNNECK, WM->getAgentBodyAngleRelToNeck( ) );
}
/*! This skill enables an agent to turn his body towards a given point. It
receives a global position 'pos' on the field and returns a turn command
that will turn the agent's body towards this point. To this end the agent's
global position in the next cycle is predicted based on his current
velocity. This is done to compensate for the fact that the remaining
velocity will move the agent to another position in the next cycle. The
global angle between the given position and the predicted position is then
determined after which the agent's global body direction is subtracted from
this angle in order to make it relative to the agent's body. Finally,
the resulting angle is normalized and adjusted to compensate for the
inertia moment and speed of the agent. If it is impossible to turn towards
the given position in a single cycle then the agent turns as far as
possible.
\param pos position to which body should be turned
\param iCycles denotes the number of cycles that are used to update the
the agent position. The resulting position is compared with
'pos' to determine the desired turning angle.
\return SoccerCommand turn command to turn body to the desired point */
SoccerCommand BasicPlayer::turnBodyToPoint ( VecPosition pos, int iCycles )
{
VecPosition posGlobal = WM->predictAgentPos ( iCycles, 0 );
AngDeg angTurn = ( pos - posGlobal ).getDirection();
angTurn -= WM->getAgentGlobalBodyAngle();
angTurn = VecPosition::normalizeAngle ( angTurn );
angTurn = WM->getAngleForTurn ( angTurn, WM->getAgentSpeed(),
WM->getAgentObjectType() );
return SoccerCommand ( CMD_TURN, angTurn );
}
/*! This skill enables an agent to turn his back towards a given point 'pos'.
The only difference between this skill and turnBodyToPoint is that the
angle between the given position and the predicted position of the agent
in the next cycle is now made relative to the back of the agent by
subtracting the agent's global back direction. This skill can for example
be used by the goalkeeper in case he wants to move back to his goal while
keeping sight of the rest of the field.
\param pos position to which the agent's back should be turned
\param iCycles denotes the number of cycles that are used to update the
the agent position. The resulting position is compared with
'pos' to determine the desired turning angle.
\return SoccerCommand command to turn agent's back to the desired point */
SoccerCommand BasicPlayer::turnBackToPoint ( VecPosition pos, int iCycles )
{
VecPosition posGlobal = WM->predictAgentPos ( iCycles, 0 );
AngDeg angTurn = ( pos - posGlobal ).getDirection();
angTurn -= ( WM->getAgentGlobalBodyAngle() + 180 );
angTurn = VecPosition::normalizeAngle ( angTurn );
angTurn = WM->getAngleForTurn ( angTurn, WM->getAgentSpeed(),
WM->getAgentObjectType() );
return SoccerCommand ( CMD_TURN, angTurn );
}
/*! This skill enables an agent to turn his neck towards a given point. It
receives a global position 'pos' on the field as well as a primary action
command 'soc' that will be executed by the agent at the end of the current
cycle and returns a turn neck command that will turn the agent's neck
towards 'pos'. To this end the agent's global position and neck direction
after executing the cmd command are predicted using methods from the world
model. The global angle between the given position and the predicted
position is then determined after which the predicted neck direction is
subtracted from this angle in order to make it relative to the agent's
neck. Finally, the resulting angle is normalized and directly passed as an
argument to the turn neck command since the actual angle with which a
player turns his neck is by definition equal to this argument.
If the resulting turn angle causes the absolute angle between
the agent's neck and body to exceed the maximum value, then the agent turns
his neck as far as possible. Note that it is necessary to supply the
selected primary command as an argument to this skill, since a turn neck
command can be executed in the same cycle as a kick, dash, turn , move
or catch command.
\param pos position to which neck should be turned
\param soc SoccerCommand that is executed in the same cycle
\return SoccerCommand turn command to turn neck to the desired point */
SoccerCommand BasicPlayer::turnNeckToPoint ( VecPosition pos, SoccerCommand soc )
{
VecPosition posMe, velMe;
AngDeg angBody, angNeck, angActual;
Stamina sta;
// predict agent information after command 'soc' is performed
// calculate the desired global angle of the neck
// calculate the desired angle of the neck relative to the body
WM->predictAgentStateAfterCommand ( soc,&posMe,&velMe,&angBody,&angNeck,&sta );
AngDeg angDesGlobNeck = ( pos - posMe ).getDirection();
AngDeg angNeckRelToBody= VecPosition::normalizeAngle ( angDesGlobNeck-angBody );
// calculate the current angle of the body relati
没有合适的资源?快使用搜索试试~ 我知道了~
Robotoos2d-kharazmi88-Fix.tar.gz_iran_trilearn
1.该资源内容由用户上传,如若侵权请联系客服进行举报
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
版权申诉
0 下载量 87 浏览量
2022-09-24
03:58:25
上传
评论
收藏 753KB GZ 举报
温馨提示
共81个文件
cpp:24个
h:18个
in:3个
trilearn (Robotoos2d kharazmi88-Fix) Source Code Team Robotoos2d kharazmi88 iran First Competition Kharzmy
资源推荐
资源详情
资源评论
收起资源包目录
Robotoos2d-kharazmi88-Fix.tar.gz (81个子文件)
Robotoos2d kharazmi88
news 1B
autom4te.cache
output.2 561KB
requests 16KB
traces.2 98KB
traces.1 29KB
output.0 199KB
traces.0 31KB
output.1 199KB
mkinstalldirs 2KB
install 9KB
config.h.in 4KB
depcomp 13KB
aclocal.m4 32KB
libtool 196KB
authors 127B
Thanks 104B
config.guess 40KB
Makefile.am 499B
config.sub 29KB
windows
bcc32.cfg 82B
start-team.bat 2KB
ilink32.cfg 38B
Makefile 3KB
src
intercept.cpp 34KB
GenericValues.h 7KB
.libs
Parse.h 3KB
Parse.cpp 8KB
GenericValues.cpp 19KB
Objects.cpp 41KB
BasicPlayer.cpp 273KB
PlayerTeams.cpp 26KB
ActHandler.cpp 11KB
SenseHandler.h 5KB
BasicPlayer.h 12KB
WorldModelHighLevel.cpp 74KB
SenseHandler.cpp 45KB
formations.conf 7KB
robotoos_logo.xpm 4KB
Logger.h 7KB
PlayerSettings.cpp 25KB
Formations.cpp 26KB
Player.h 5KB
ServerSettings.h 36KB
TeamGraphic.cpp 11KB
WorldModel.cpp 111KB
mainCoach.cpp 9KB
BasicCoach.h 5KB
Formations.h 9KB
Objects.h 15KB
Connection.h 4KB
Player.cpp~ 48KB
Makefile.am 1KB
WorldModelUpdate.cpp 122KB
Makefile.in 16KB
SoccerTypes.cpp 86KB
Connection.cpp 10KB
main.cpp 11KB
WorldModel.h 46KB
ServerSettings.cpp 96KB
WorldModelPredict.cpp 38KB
intercept.h 3KB
ActHandler.h 5KB
player.conf 595B
Player.cpp 48KB
Geometry.h 14KB
Logger.cpp 14KB
BasicCoach.cpp 33KB
TeamGraphic.h 5KB
PlayerSettings.h 10KB
SoccerTypes.h 40KB
Geometry.cpp 63KB
Makefile.in 19KB
missing 10KB
install-sh 7KB
copying 18KB
configure 199KB
ltmain.sh 176KB
start.sh 3KB
readme 21KB
ChangeLog 40B
configure.ac 818B
共 81 条
- 1
资源评论
小贝德罗
- 粉丝: 69
- 资源: 1万+
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功