/*
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.
*/
/*
这个Basic Player模块记录了所有的球员基本技能,它仅仅负责指定生成动作用于记录到命令队列,而不会进行高层的决策判断。
有些关键动作一个周期只允许发送一次,但是一些动作是允许在一个一个周期内执行多个的,比如转动脖子指令。
注释修改:05计算机2 席浩洋
*/
/*! \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
/********************** 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 */
/* 这个命令用于让球员将脖子转向身体前方(于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 */
/* 这个函数用于将身体转向一个绝对点,当无法进行那么大角度的转动,则尽力的转动最大角度
pos : 参数指定绝对点
iCycles = 1 : 预测当前球员于几个周期后的位置,然后会以那个点为基点进行转身,默认计算一个周期之后的位置
返回一个转体指令 (之后的所有返回,因为和功能类似所以不再赘述)*/
SoccerCommand BasicPlayer::turnBodyToPoint( VecPosition pos, int iCycles )
{
VecPosition posGlobal = WM->predictAgentPos(iCycles, 0);//预测iCycles周期后当前球员的位置
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 ac
没有合适的资源?快使用搜索试试~ 我知道了~
UVA.tar.gz_UVA_robocup
1.该资源内容由用户上传,如若侵权请联系客服进行举报
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
版权申诉
0 下载量 127 浏览量
2022-09-23
11:31:53
上传
评论
收藏 3.44MB GZ 举报
温馨提示
共138个文件
po:22个
cpp:22个
o:22个
Uva(荷兰阿木斯特丹大学底层代码)用于Robocup前期练习的主要代码。
资源推荐
资源详情
资源评论
收起资源包目录
UVA.tar.gz_UVA_robocup (138个子文件)
configure.ac 818B
Makefile.am 1KB
Makefile.am 499B
authors 660B
start-team.bat 2KB
start-team.bat~ 2KB
bcc32.cfg 82B
ilink32.cfg 38B
ChangeLog 126B
formations.conf 5KB
player.conf 595B
configure 644KB
formations.conf~ 5KB
copying 18KB
BasicPlayer.cpp 162KB
WorldModelUpdate.cpp 125KB
WorldModel.cpp 117KB
ServerSettings.cpp 104KB
SoccerTypes.cpp 89KB
WorldModelHighLevel.cpp 71KB
Geometry.cpp 63KB
WorldModelPredict.cpp 49KB
Objects.cpp 41KB
SenseHandler.cpp 41KB
Player.cpp 29KB
Formations.cpp 27KB
PlayerSettings.cpp 26KB
GenericValues.cpp 20KB
PlayerTeams.cpp 18KB
Logger.cpp 14KB
main.cpp 12KB
ActHandler.cpp 11KB
Connection.cpp 10KB
mainCoach.cpp 10KB
BasicCoach.cpp 8KB
Parse.cpp 8KB
BasicPlayer.cpp~ 162KB
WorldModel.cpp~ 117KB
SoccerTypes.cpp~ 89KB
Geometry.cpp~ 63KB
WorldModelPredict.cpp~ 38KB
Player.cpp~ 29KB
PlayerSettings.cpp~ 25KB
PlayerTeams.cpp~ 18KB
main.cpp~ 12KB
depcomp 13KB
Doxyfile 10KB
config.guess 40KB
WorldModel.h 54KB
ServerSettings.h 44KB
SoccerTypes.h 44KB
Objects.h 17KB
Geometry.h 16KB
PlayerSettings.h 10KB
BasicPlayer.h 10KB
Formations.h 10KB
GenericValues.h 7KB
Logger.h 7KB
SenseHandler.h 6KB
ActHandler.h 5KB
Player.h 5KB
Connection.h 4KB
config.h 4KB
BasicCoach.h 4KB
Parse.h 3KB
WorldModel.h~ 54KB
SoccerTypes.h~ 44KB
Geometry.h~ 16KB
PlayerSettings.h~ 10KB
BasicPlayer.h~ 10KB
Makefile.in 19KB
Makefile.in 17KB
config.h.in 4KB
install 9KB
install-sh 7KB
libtool 196KB
config.log 46KB
aclocal.m4 231KB
Makefile 17KB
Makefile 17KB
Makefile 3KB
missing 10KB
mkinstalldirs 2KB
news 105B
WorldModel.o 542KB
WorldModelUpdate.o 418KB
WorldModelHighLevel.o 406KB
BasicPlayer.o 367KB
main.o 310KB
Player.o 290KB
mainCoach.o 289KB
WorldModelPredict.o 269KB
SenseHandler.o 263KB
ServerSettings.o 244KB
PlayerTeams.o 242KB
BasicCoach.o 216KB
ActHandler.o 215KB
SoccerTypes.o 206KB
Logger.o 165KB
Objects.o 159KB
共 138 条
- 1
- 2
资源评论
朱moyimi
- 粉丝: 61
- 资源: 1万+
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功