📄 objects.h
字号:
/*
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 Objects.h
<pre>
<b>File:</b> Objects.h
<b>Project:</b> Robocup Soccer Simulation Team: UvA Trilearn
<b>Authors:</b> Jelle Kok
<b>Created:</b> 1/12/2000
<b>Last Revision:</b> $ID$
<b>Contents:</b> class declarations Object, DynamicObject, FixedObject,
PlayerObject, BallObject and Stamina
<hr size=2>
<h2><b>Changes</b></h2>
<b>Date</b> <b>Author</b> <b>Comment</b>
1/12/2001 Jelle Kok Initial version created
</pre>
*/
#ifndef _OBJECTS_
#define _OBJECTS_
#include "SoccerTypes.h" // needed for ObjectT
/*****************************************************************************/
/********************** CLASS OBJECT *****************************************/
/*****************************************************************************/
/*! Class Object contains RoboCup information that is available for all objects
in the simulation. All (relative) information is relative to an agent as
declared in AgentObject. Update of an object (or one of the subclasses)
happens by calling the standard get and set methods available in these
classes. Calculations on these attributes do not occur in these classes,
but in the update methods of the WorldModel. */
class Object
{
protected:
ObjectT objectType; /*!< Type of this object */
Time timeLastSeen; /*!< Time last see message has arrived */
VecPosition posGlobal; /*!< Global position in the field */
Time timeGlobalPosition; /*!< Server time of global position */
VecPosition posRelative; /*!< Relative position of the object */
Time timeRelativePosition; /*!< Server time of relative position */
VecPosition posGlobalLastSee; /*!< Global position of last see msg */
Time timeGlobalPosDerivedFromSee;/*!< Time pos derived from see msg */
public:
Object( );
/*! abstract function that should be defined in a subclass */
virtual void show( ostream& os = cout ) = 0;
// non-standard get and set methods (all defined here)
AngDeg getRelativeAngle ( );
double getRelativeDistance ( );
double getConfidence ( Time time );
// standard get and set methods
bool setType ( ObjectT o );
ObjectT getType ( ) const;
bool setRelativePosition ( double dDist,
AngDeg dAng,
Time time );
bool setRelativePosition ( VecPosition v,
Time time );
VecPosition getRelativePosition ( ) const;
bool setTimeRelativePosition ( Time time );
Time getTimeRelativePosition ( ) const;
bool setGlobalPosition ( VecPosition p,
Time time );
VecPosition getGlobalPosition ( ) const;
bool setTimeGlobalPosition ( Time time );
Time getTimeGlobalPosition ( ) const;
bool setGlobalPositionLastSee ( VecPosition p,
Time time );
VecPosition getGlobalPositionLastSee ( ) const;
bool setTimeGlobalPosDerivedFromSee( Time time );
Time getTimeGlobalPosDerivedFromSee( ) const;
bool setTimeLastSeen ( Time time );
Time getTimeLastSeen ( ) const;
};
/*****************************************************************************/
/********************** CLASS FIXEDOBJECT ************************************/
/*****************************************************************************/
/*! Class FixedObject contains RoboCup information that is available for
objects that cannot move (flags, goals, lines). No additional information
is added to the superclass Object. */
class FixedObject : public Object
{
public:
// specific methods
VecPosition getGlobalPosition( SideT s, double dGoalWidth = 14.02 ) const;
AngDeg getGlobalAngle ( SideT s );
void show ( ostream & os = cout );
};
/*****************************************************************************/
/********************** CLASS DYNAMICOBJECT **********************************/
/*****************************************************************************/
/*! Class DynamicObject contains RoboCup information that is available for
objects that can move (players, ball). Different variables are added to
the superclass Object */
class DynamicObject: public Object
{
protected:
// global velocity information
VecPosition vecGlobalVelocity; /*!< Global velocity of the player */
Time timeGlobalVelocity; /*!< Time of the corresponding velocity*/
// sensor information
double dRelativeDistanceChange;/*!< Relative distance change */
double dRelativeAngleChange; /*!< Relative angle change */
Time timeChangeInformation; /*!< Time of change information */
VecPosition vecGlobalVelocityLastSee;/*!< vel. derived from last see */
public:
DynamicObject( );
// standard get and set methods
bool setRelativeDistanceChange( double d, Time time );
double getRelativeDistanceChange( ) const;
bool setRelativeAngleChange ( double d, Time time );
double getRelativeAngleChange ( ) const;
bool setTimeChangeInformation ( Time time );
Time getTimeChangeInformation ( ) const;
bool setGlobalVelocity ( VecPosition v, Time time );
VecPosition getGlobalVelocity ( ) const;
double getSpeed ( ) const;
bool setTimeGlobalVelocity ( Time time );
Time getTimeGlobalVelocity ( ) const;
bool setGlobalVelocityLastSee ( VecPosition vec );
VecPosition getGlobalVelocityLastSee ( ) const;
};
/*****************************************************************************/
/********************* CLASS PLAYEROBJECT ************************************/
/*****************************************************************************/
/*! Class PlayerObject contains RoboCup information that is available for
players. Different variables are added to the superclass DynamicObject */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -