📄 objects.h
字号:
/*********************************************************************************** In the name of Almighty ** ** Objects.h : Robocup 3D Soccer Simulation Team Zigorat ** (This team was previously named Gcyrus) ** ** Date: 03/20/2007 ** Author: Mahdi Hamdarsi ** Comments: This file contains Objects decleration which represent soccer ** players, flags, etc. ** ***********************************************************************************//*! \file Objects.h<pre><b>File:</b> Objects.h<b>Project:</b> Robocup Soccer Simulation Team: Zigorat<b>Authors:</b> Mahdi Hamdarsi<b>Created:</b> 03/20/2007<b>Last Revision:</b> $ID$<b>Contents:</b> This file contains Objects decleration which represent soccer players, flags, etc.<hr size=2><h2><b>Changes</b></h2><b>Date</b> <b>Author</b> <b>Comment</b>03/20/2007 Mahdi Initial version created</pre>*/#include "Geometry.h" // Needed for VecPosition#include "Logger.h" // needed for Logger#include "SoccerTypes.h"#ifndef _OBJECTS_#define _OBJECTS_/*****************************************************************************//******************** CLASS OBJECT ****************************************//*****************************************************************************//*! Class Object contains RoboCup information that is available for all objects in the simulation. 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: VecPosition m_Position; /*!< Global posititon of this object */ Time m_TimeLastSeen; /*!< Time last see message has arrived */ public: Object ( ); virtual ~ Object ( ); VecPosition getPosition ( ) const; virtual void setPosition ( VecPosition newPos ); Time getTimeLastSeen( ) const; bool setTimeLastSeen( Time time );};/*****************************************************************************//******************** CLASS FLAGOBJECT ************************************//*****************************************************************************//*! Class FlagObject contains RoboCup information that is available for flags. No additional information is added to the superclass Object. */class FlagObject:public Object{ ObjectT m_ID; public: FlagObject ( ); virtual ~FlagObject ( ); ObjectT getID ( ) const; bool setID ( ObjectT obj );};/*****************************************************************************//******************** 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: bool m_IsFirstPosition; /*!< Internal to derive the velocity */ bool m_IsFirstVelocity; /*!< Internal to derive the acceleration */ VecPosition m_Velocity; /*!< Current velocity of object */ VecPosition m_Accelaration; /*!< Current acceleration of object */ public: DynamicObject ( ); virtual ~DynamicObject ( ); VecPosition getVelocity ( ) const; VecPosition getAccelaration( ) const; virtual void setPosition (VecPosition newPos );};/*****************************************************************************//******************** CLASS BALLOBJECT ************************************//*****************************************************************************//*! Class PlayerObject contains RoboCup information that is available for the ball. No extra variables are added to superclass DynamicObject*/class BallObject: public DynamicObject{ protected: double m_Mass; /*!< Mass of the ball */ double m_Radius; /*!< Radius of the ball */ public: BallObject ( ); virtual ~BallObject ( ); double getMass ( ) const; double getRadius ( ) const; bool setMass ( double value ); bool setRadius ( double value );};/*****************************************************************************//********************* CLASS PLAYEROBJECT ************************************//*****************************************************************************//*! Class PlayerObject contains RoboCup information that is available for players. Different variables are added to the superclass DynamicObject */class PlayerObject:public DynamicObject{ protected: int m_Number; /*!< Number of the player in his team */ SideT m_TeamSide; /*!< Team side of the player */ AngDeg m_Direction; /*!< Direction of which Player is going towards */ public: PlayerObject ( ); ~PlayerObject ( ); int getNumber ( ) const; virtual bool setNumber ( int num ); AngDeg getDirection ( ) const; bool setDirection ( AngDeg ang ); SideT getTeamSide ( ) const; bool setTeamSide ( SideT newSide );};/*****************************************************************************//***************************** CLASS AGENTOBJECT *****************************//*****************************************************************************//*! Class AgentObject contains RoboCup information that is available for the agent. New variables are declared that extend a normal PlayerObject.*/class AgentObject:public PlayerObject{ protected: double m_Battery; /*!< battery pack remaining power of the battery */ double m_Temprature; /*!< Temperature of the robot */ double m_Mass; /*!< Mass of the robot */ double m_MaxSpeed; /*!< Maximum speed of the robot */ public: AgentObject ( ); virtual ~AgentObject ( ); double getBattery ( ) const; bool setBattery ( double value ); double getTemprature ( ) const; bool setTemprature ( double value ); double getMass ( ) const; bool setMass ( double value );};/*****************************************************************************//******************************* CLASS JOINT *********************************//*****************************************************************************//*! Class Joint contains information about joint, hinges like ankle to glue the parts of agents body together and to make work smoother. contains only information.*/class Joint{ protected: double m_Axis1; /*!< First axis of joint */ double m_Axis2; /*!< Second axis of joint */ double m_Rate1; /*!< First rate of joint */ double m_Rate2; /*!< Second rate of joint */ JointT m_ID; /*!< Name of the joint */ public: Joint ( ); Joint ( const Joint & jnt ); ~ Joint ( ); Joint& operator = ( const Joint & jnt ); friend ostream& operator <<( ostream &os, Joint j ); friend Logger& operator << ( Logger &log, Joint j ); double getAxis ( ) const; bool setAxis ( double value ); double getAxis1 ( ) const; bool setAxis1 ( double value ); double getAxis2 ( ) const; bool setAxis2 ( double value ); double getRate ( ) const; bool setRate ( double value ); double getRate1 ( ) const; bool setRate1 ( double value ); double getRate2 ( ) const; bool setRate2 ( double value ); JointT getID ( ) const; bool setID ( JointT value ); void show ( ostream & os = cout ) const; void show ( Logger & os ) const;};/*****************************************************************************//****************************** CLASS TSensor ********************************//*****************************************************************************//*! This clas represnets a sensor in the current smimulator */class TSensor{ protected: double m_Value; /*!< Value of the sensor */ string m_Name; /*!< Name of the sensor */ public: TSensor ( ); ~ TSensor ( ); double getValue ( ) const; bool setValue ( const double & val ); string getName ( ) const; bool setName ( string name );};#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -