00001 /* -*- Mode: C++ -*- 00002 * $Id: BallView.cc,v 1.16 2003/06/02 07:18:10 frehe Exp $ 00003 * 00004 * 00005 * COPYRIGHT INFORMATION 00006 * 00007 * This file is part of RoboSoc created by Fredrik Heintz <frehe@ida.liu.se> 00008 * Copyright (C) 1999, 2000 Fredrik Heintz, Linköping University, Sweden 00009 * 00010 * You are allowed to modify and use this code as long as you retain this 00011 * notice. If you make any changes or have any comments I would appreciate 00012 * it if you send me a message. For more information, please see 00013 * http://www.ida.liu.se/~frehe/RoboCup/RoboSoc/ 00014 * 00015 * 00016 * IDENTIFICATION 00017 * 00018 * Filename: BallView.cc 00019 * Unitname: Framework/view 00020 * $Revision: 1.16 $ 00021 * Created by: Fredrik Heintz 1999-xx-xx 00022 * Last modified by $Author: frehe $ $Date: 2003/06/02 07:18:10 $ 00023 * 00024 * 00025 * HISTORY 00026 * 00027 * $Log: BallView.cc,v $ 00028 * Revision 1.16 2003/06/02 07:18:10 frehe 00029 * Changed iostream.h to iostream. 00030 * 00031 * Revision 1.15 2002/09/26 15:28:41 s02davro 00032 * Moved isBallKickable to cc and corrected it 00033 * 00034 * Revision 1.14 2002/08/31 15:22:45 s02davro 00035 * Small changes in views 00036 * 00037 * Revision 1.13 2002/08/02 21:53:13 s02davro 00038 * Now works by extracting information from the BallObject, uses AgentView as before. 00039 * 00040 * Revision 1.12 2001/09/17 22:20:21 frehe 00041 * Added some functionality to use the realtive speed of the ball from rccparser, but it is not used at the moment. 00042 * 00043 * Revision 1.11 2001/09/17 21:27:38 andbo928 00044 * Removed FutureBallView references. 00045 * 00046 * Revision 1.10 2001/09/01 23:49:51 frehe 00047 * Updated the file for the new implementation of getValue and getAngle. 00048 * 00049 * Revision 1.9 2001/08/23 00:32:04 frehe 00050 * Removed dependencies. 00051 * 00052 * Revision 1.8 2001/08/22 21:04:02 frehe 00053 * Removed an inline statement. 00054 * 00055 * Revision 1.7 2001/01/11 22:00:20 olalu526 00056 * Added the real world model with support for new simulation steps. 00057 * 00058 * Revision 1.6 2001/01/10 15:12:59 olalu526 00059 * Added support for WorldModel to some basic classes. 00060 * 00061 * Revision 1.5 2000/10/23 12:06:24 frehe 00062 * Fixed the ball speed estimation. 00063 * 00064 * Revision 1.4 2000/10/11 18:39:11 frehe 00065 * Changed the ball speed estimation. 00066 * 00067 * Revision 1.3 2000/10/08 12:11:04 frehe 00068 * Fixed a bug in BallView. 00069 * 00070 * Revision 1.2 2000/10/04 12:03:15 frehe 00071 * Made some minor changes. 00072 * 00073 * Revision 1.1 2000/09/21 13:46:46 frehe 00074 * Move the RoboSoc views from rsviews to the rsframework library. 00075 * 00076 * Revision 1.3 2000/09/13 00:08:06 frehe 00077 * Updated the views to inherit from the ViewWithHistory instead and also changed those views that used a static pointer to itself to do process the data in the sensor interface to use the new forEach methods implemented in the FrameworkSensorInterface. 00078 * 00079 * Revision 1.2 2000/09/05 21:15:57 frehe 00080 * Made minor changes. 00081 * 00082 * Revision 1.1 2000/09/04 15:27:20 frehe 00083 * Imported the current version of RoboSoc (soon to be v2.5.0) 00084 * 00085 */ 00086 00098 #include <iostream> 00099 #include "view_constants.h" 00100 #include "ViewManager.h" 00101 #include "AgentView.h" 00102 #include "BallView.h" 00103 00104 00105 RS_BEGIN_NAMESPACE 00106 00107 BallView::BallView(const ViewId id) 00108 : View(id), 00109 agentView(NULL), 00110 facts(worldModelInterface->getWorldFacts()) { 00111 getView(agentView, AGENT_VIEW_ID); 00112 } 00113 00114 BallView::~BallView() { 00115 viewManager->releaseView(AGENT_VIEW_ID); 00116 } 00117 00118 bool BallView::isBallCatchable(const Int hist) const { 00119 if (getRelativeVector(hist).isKnown()) 00120 return (getRelativeVector(hist).getLength() < 00121 facts->SP_catchable_area_l); 00122 return false; 00123 } 00124 00125 bool BallView::isBallKickable(const Int hist) const { 00126 if (getRelativeVector(hist).isKnown()) 00127 return (getRelativeDistance(hist) < facts->SP_kickable_area); 00128 return false; 00129 } 00130 00131 RS_END_NAMESPACE 00132 00133 00134 /* CONDITIONAL INCLUSION OF INLINE DEFINITIONS 00135 * 00136 * If the compiler or debugger does not understand the keyword inline then 00137 * include the inline definitions here, otherwise include them in the 00138 * declaration file. 00139 * 00140 * This is controlled by a flag called RS_USE_INLINE, which is usually 00141 * defined. It can be set by the user by giving the compiler an argument 00142 * usually -DRS_USE_INLINE (to define it) or -URS_USE_INLINE (to undefine it). 00143 */ 00144 00145 #ifndef RS_USE_INLINE 00146 # include "BallView.icc" 00147 #endif
1.3-rc3