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: kickeffector.h,v 1.5 2006/03/01 15:49: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 #ifndef KICKEFFECTOR_H 00023 #define KICKEFFECTOR_H 00024 00025 #include <salt/random.h> 00026 #include <oxygen/agentaspect/agentaspect.h> 00027 #include <oxygen/agentaspect/effector.h> 00028 #include <oxygen/physicsserver/body.h> 00029 #include <soccer/ball/ball.h> 00030 #include <soccer/ballstateaspect/ballstateaspect.h> 00031 00032 class KickEffector : public oxygen::Effector 00033 { 00034 public: 00035 KickEffector(); 00036 virtual ~KickEffector(); 00037 00039 virtual bool Realize(boost::shared_ptr<oxygen::ActionObject> action); 00040 00042 virtual std::string GetPredicate() { return "kick"; } 00043 00045 virtual boost::shared_ptr<oxygen::ActionObject> 00046 GetActionObject(const oxygen::Predicate& predicate); 00047 00049 virtual void OnLink(); 00050 00052 virtual void OnUnlink(); 00053 00055 void SetKickMargin(float margin); 00056 00061 void SetForceFactor(float force_factor); 00062 00067 void SetTorqueFactor(float torque_factor); 00068 00072 void SetSteps(int steps); 00073 00084 void SetNoiseParams(double sigma_force, 00085 double sigma_theta, 00086 double sigma_phi_end, 00087 double sigma_phi_mid); 00088 00090 void SetMaxPower(float max_power); 00091 00098 void SetAngleRange(float min, float max); 00099 00100 protected: 00101 typedef boost::shared_ptr<salt::NormalRNG<> > NormalRngPtr; 00102 00104 boost::shared_ptr<oxygen::Body> mBallBody; 00106 boost::shared_ptr<Ball> mBall; 00108 boost::shared_ptr<oxygen::AgentAspect> mAgent; 00109 00111 NormalRngPtr mForceErrorRNG; 00113 NormalRngPtr mThetaErrorRNG; 00114 00115 private: 00117 float mKickMargin; 00119 float mPlayerRadius; 00121 float mBallRadius; 00123 float mForceFactor; 00125 float mTorqueFactor; 00127 float mMaxPower; 00129 float mMinAngle; 00131 float mMaxAngle; 00133 int mSteps; 00135 double mSigmaPhiEnd; 00137 double mSigmaPhiMid; 00138 }; 00139 00140 DECLARE_CLASS(KickEffector); 00141 00142 #endif // KICKEFFECTOR_H