Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members

soccercontrolaspect.cpp

Go to the documentation of this file.
00001 /* -*- mode: c++; c-basic-offset: 4; indent-tabs-mode: nil -*-
00002 
00003    this file is part of rcssserver3D
00004    Fri May 9 2003
00005    Copyright (C) 2002,2003 Koblenz University
00006    Copyright (C) 2003 RoboCup Soccer Server 3D Maintenance Group
00007    $Id: soccercontrolaspect.cpp,v 1.2 2004/02/12 14:07:26 fruit Exp $
00008 
00009    This program is free software; you can redistribute it and/or modify
00010    it under the terms of the GNU General Public License as published by
00011    the Free Software Foundation; version 2 of the License.
00012 
00013    This program is distributed in the hope that it will be useful,
00014    but WITHOUT ANY WARRANTY; without even the implied warranty of
00015    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00016    GNU General Public License for more details.
00017 
00018    You should have received a copy of the GNU General Public License
00019    along with this program; if not, write to the Free Software
00020    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
00021 */
00022 #include "soccercontrolaspect.h"
00023 #include <zeitgeist/logserver/logserver.h>
00024 #include <zeitgeist/scriptserver/scriptserver.h>
00025 #include <oxygen/sceneserver/scene.h>
00026 #include <oxygen/physicsserver/recorderhandler.h>
00027 #include <oxygen/physicsserver/body.h>
00028 #include <soccer/ball/ball.h>
00029 
00030 using namespace oxygen;
00031 using namespace boost;
00032 using namespace std;
00033 using namespace salt;
00034 
00035 SoccerControlAspect::SoccerControlAspect() : ControlAspect()
00036 {
00037 }
00038 
00039 SoccerControlAspect::~SoccerControlAspect()
00040 {
00041 }
00042 
00043 void SoccerControlAspect::OnLink()
00044 {
00045     shared_ptr<Scene> scene = GetActiveScene();
00046     if (scene.get() == 0)
00047         {
00048             GetLog()->Error()
00049                 << "(SoccerControlAspect) found no active scene node\n";
00050             return;
00051         }
00052 
00053     mScenePath = scene->GetFullPath();
00054 }
00055 
00056 shared_ptr<RecorderHandler> SoccerControlAspect::GetBallRecorder()
00057 {
00058     shared_ptr<RecorderHandler> node = shared_dynamic_cast<RecorderHandler>
00059         (GetCore()->Get(mScenePath + "Ball/geometry/recorder"));
00060 
00061     if (node.get() == 0)
00062         {
00063             GetLog()->Error()
00064                 << "(SoccerControlAspect) found no ball collision recorder\n";
00065         }
00066 
00067     return node;
00068 }
00069 
00070 shared_ptr<RecorderHandler> SoccerControlAspect::GetFieldRecorder()
00071 {
00072     shared_ptr<RecorderHandler> node = shared_dynamic_cast<RecorderHandler>
00073         (GetCore()->Get(mScenePath + "FieldBox/recorder"));
00074 
00075     if (node.get() == 0)
00076         {
00077             GetLog()->Error()
00078                 << "(SoccerControlAspect) found no field collision recorder\n";
00079         }
00080 
00081     return node;
00082 }
00083 
00084 shared_ptr<RecorderHandler> SoccerControlAspect::GetLeftGoalRecorder()
00085 {
00086     shared_ptr<RecorderHandler> node = shared_dynamic_cast<RecorderHandler>
00087         (GetCore()->Get(mScenePath + "GoalBoxL/recorder"));
00088 
00089     if (node.get() == 0)
00090         {
00091             GetLog()->Error()
00092                 << "(SoccerControlAspect) found no left goal collision recorder\n";
00093         }
00094 
00095     return node;
00096 }
00097 
00098 shared_ptr<RecorderHandler> SoccerControlAspect::GetRightGoalRecorder()
00099 {
00100     shared_ptr<RecorderHandler> node = shared_dynamic_cast<RecorderHandler>
00101         (GetCore()->Get(mScenePath + "GoalBoxR/recorder"));
00102 
00103     if (node.get() == 0)
00104         {
00105             GetLog()->Error()
00106                 << "(SoccerControlAspect) found no right goal collision recorder\n";
00107         }
00108 
00109     return node;
00110 }
00111 
00112 

Generated on Thu Apr 6 15:25:40 2006 for rcssserver3d by  doxygen 1.4.4