From: <a-...@us...> - 2009-11-18 07:42:32
|
Revision: 103 http://simspark.svn.sourceforge.net/simspark/?rev=103&view=rev Author: a-held Date: 2009-11-18 07:42:23 +0000 (Wed, 18 Nov 2009) Log Message: ----------- undid changes to trunk that were accidentally commited yesterday Modified Paths: -------------- trunk/spark/lib/oxygen/CMakeLists.txt trunk/spark/lib/oxygen/oxygen.cpp trunk/spark/lib/oxygen/oxygen.h trunk/spark/lib/oxygen/physicsserver/body.cpp trunk/spark/lib/oxygen/physicsserver/body.h trunk/spark/lib/oxygen/physicsserver/boxcollider.h trunk/spark/lib/oxygen/physicsserver/collider.h trunk/spark/lib/oxygen/physicsserver/collisionhandler.h trunk/spark/lib/oxygen/physicsserver/joint.h trunk/spark/lib/oxygen/physicsserver/physicsserver.h trunk/spark/lib/oxygen/physicsserver/space.h trunk/spark/lib/oxygen/physicsserver/world.cpp trunk/spark/lib/oxygen/physicsserver/world.h trunk/spark/lib/oxygen/physicsserver/world_c.cpp trunk/spark/plugin/collisionperceptor/forceresistanceperceptor.cpp trunk/spark/plugin/collisionperceptor/forceresistanceperceptor.h Added Paths: ----------- trunk/spark/lib/oxygen/physicsserver/odeobject.cpp trunk/spark/lib/oxygen/physicsserver/odeobject.h trunk/spark/lib/oxygen/physicsserver/odeobject_c.cpp trunk/spark/lib/oxygen/physicsserver/odewrapper.h Removed Paths: ------------- trunk/spark/lib/oxygen/physicsserver/imp/ trunk/spark/lib/oxygen/physicsserver/ode/ Modified: trunk/spark/lib/oxygen/CMakeLists.txt =================================================================== --- trunk/spark/lib/oxygen/CMakeLists.txt 2009-11-18 07:24:29 UTC (rev 102) +++ trunk/spark/lib/oxygen/CMakeLists.txt 2009-11-18 07:42:23 UTC (rev 103) @@ -21,6 +21,8 @@ physicsserver/collider.h physicsserver/collisionhandler.h physicsserver/contactjointhandler.h + physicsserver/odeobject.h + physicsserver/odewrapper.h physicsserver/physicsserver.h physicsserver/planecollider.h physicsserver/raycollider.h @@ -39,15 +41,6 @@ physicsserver/universaljoint.h physicsserver/hinge2joint.h physicsserver/angularmotor.h - - #interfaces - physicsserver/imp/worldimp.h - - #ode-specific files - physicsserver/ode/odeobject.h - physicsserver/ode/odeworld.h - physicsserver/ode/odewrapper.h - sceneserver/sceneimporter.h sceneserver/basenode.h sceneserver/fpscontroller.h @@ -123,6 +116,8 @@ physicsserver/collisionhandler_c.cpp physicsserver/contactjointhandler.cpp physicsserver/contactjointhandler_c.cpp + physicsserver/odeobject.cpp + physicsserver/odeobject_c.cpp physicsserver/physicsserver.cpp physicsserver/physicsserver_c.cpp physicsserver/planecollider.cpp @@ -157,16 +152,6 @@ physicsserver/hinge2joint_c.cpp physicsserver/angularmotor.cpp physicsserver/angularmotor_c.cpp - - #interfaces - physicsserver/imp/worldimp_c.cpp - - #ODE-specific files - physicsserver/ode/odeworld.cpp - physicsserver/ode/odeworld_c.cpp - physicsserver/ode/odeobject.cpp - physicsserver/ode/odeobject_c.cpp - sceneserver/basenode.cpp sceneserver/basenode_c.cpp sceneserver/fpscontroller.cpp Modified: trunk/spark/lib/oxygen/oxygen.cpp =================================================================== --- trunk/spark/lib/oxygen/oxygen.cpp 2009-11-18 07:24:29 UTC (rev 102) +++ trunk/spark/lib/oxygen/oxygen.cpp 2009-11-18 07:42:23 UTC (rev 103) @@ -57,9 +57,9 @@ zg.GetCore()->RegisterClassObject(new CLASS(BodyController), "oxygen/"); zg.GetCore()->RegisterClassObject(new CLASS(DragController), "oxygen/"); zg.GetCore()->RegisterClassObject(new CLASS(VelocityController), "oxygen/"); + zg.GetCore()->RegisterClassObject(new CLASS(ODEObject), "oxygen/"); zg.GetCore()->RegisterClassObject(new CLASS(Space), "oxygen/"); zg.GetCore()->RegisterClassObject(new CLASS(World), "oxygen/"); - zg.GetCore()->RegisterClassObject(new CLASS(WorldImp), "oxygen/"); zg.GetCore()->RegisterClassObject(new CLASS(Joint), "oxygen/"); zg.GetCore()->RegisterClassObject(new CLASS(BallJoint), "oxygen/"); zg.GetCore()->RegisterClassObject(new CLASS(HingeJoint), "oxygen/"); @@ -86,11 +86,6 @@ zg.GetCore()->RegisterClassObject(new CLASS(AgentAspect), "oxygen/"); zg.GetCore()->RegisterClassObject(new CLASS(Effector), "oxygen/"); zg.GetCore()->RegisterClassObject(new CLASS(Perceptor), "oxygen/"); - - //ODE-specific classes - zg.GetCore()->RegisterClassObject(new CLASS(ODEObject), "oxygen/"); - zg.GetCore()->RegisterClassObject(new CLASS(ODEWorld), "oxygen/"); - #ifdef HAVE_SPADES_HEADERS // spades Modified: trunk/spark/lib/oxygen/oxygen.h =================================================================== --- trunk/spark/lib/oxygen/oxygen.h 2009-11-18 07:24:29 UTC (rev 102) +++ trunk/spark/lib/oxygen/oxygen.h 2009-11-18 07:42:23 UTC (rev 103) @@ -34,7 +34,6 @@ #include "gamecontrolserver/actionobject.h" #include "gamecontrolserver/behavior.h" -//abstract physics classes #include "physicsserver/body.h" #include "physicsserver/bodycontroller.h" #include "physicsserver/dragcontroller.h" @@ -43,6 +42,7 @@ #include "physicsserver/boxcollider.h" #include "physicsserver/ccylindercollider.h" #include "physicsserver/collider.h" +#include "physicsserver/odeobject.h" #include "physicsserver/physicsserver.h" #include "physicsserver/planecollider.h" #include "physicsserver/raycollider.h" @@ -60,13 +60,6 @@ #include "physicsserver/universaljoint.h" #include "physicsserver/hinge2joint.h" -//physics interfaces -#include "physicsserver/imp/worldimp.h" - -//ode-specific includes -#include <oxygen/physicsserver/ode/odeobject.h> -#include <oxygen/physicsserver/ode/odeworld.h> - #include "sceneserver/basenode.h" #include "sceneserver/camera.h" #include "sceneserver/fpscontroller.h" Modified: trunk/spark/lib/oxygen/physicsserver/body.cpp =================================================================== --- trunk/spark/lib/oxygen/physicsserver/body.cpp 2009-11-18 07:24:29 UTC (rev 102) +++ trunk/spark/lib/oxygen/physicsserver/body.cpp 2009-11-18 07:42:23 UTC (rev 103) @@ -339,7 +339,7 @@ // direction: (1=x, 2=y, 3=z) int direction = 3; - dMassSetCapsule (&mass, density, direction, radius, length); + dMassSetCappedCylinder (&mass, density, direction, radius, length); } void Body::SetCappedCylinder (float density, float radius, float length) @@ -361,7 +361,7 @@ // direction: (1=x, 2=y, 3=z) int direction = 3; - dMassSetCapsuleTotal(&mass, total_mass, direction, radius, length); + dMassSetCappedCylinderTotal(&mass, total_mass, direction, radius, length); } void Body::SetCappedCylinderTotal(float total_mass, float radius, float length) Modified: trunk/spark/lib/oxygen/physicsserver/body.h =================================================================== --- trunk/spark/lib/oxygen/physicsserver/body.h 2009-11-18 07:24:29 UTC (rev 102) +++ trunk/spark/lib/oxygen/physicsserver/body.h 2009-11-18 07:42:23 UTC (rev 103) @@ -23,7 +23,7 @@ #define OXYGEN_BODY_H #include <oxygen/oxygen_defines.h> -#include <oxygen/physicsserver/ode/odeobject.h> +#include "odeobject.h" namespace oxygen { Modified: trunk/spark/lib/oxygen/physicsserver/boxcollider.h =================================================================== --- trunk/spark/lib/oxygen/physicsserver/boxcollider.h 2009-11-18 07:24:29 UTC (rev 102) +++ trunk/spark/lib/oxygen/physicsserver/boxcollider.h 2009-11-18 07:42:23 UTC (rev 103) @@ -23,7 +23,7 @@ #define OXYGEN_BOXCOLLIDER_H #include <oxygen/oxygen_defines.h> -#include <oxygen/physicsserver/collider.h> +#include "collider.h" namespace oxygen { Modified: trunk/spark/lib/oxygen/physicsserver/collider.h =================================================================== --- trunk/spark/lib/oxygen/physicsserver/collider.h 2009-11-18 07:24:29 UTC (rev 102) +++ trunk/spark/lib/oxygen/physicsserver/collider.h 2009-11-18 07:42:23 UTC (rev 103) @@ -22,7 +22,7 @@ #ifndef OXYGEN_COLLIDER_H #define OXYGEN_COLLIDER_H -#include <oxygen/physicsserver/ode/odeobject.h> +#include "odeobject.h" #include <string> #include <set> #include <oxygen/oxygen_defines.h> Modified: trunk/spark/lib/oxygen/physicsserver/collisionhandler.h =================================================================== --- trunk/spark/lib/oxygen/physicsserver/collisionhandler.h 2009-11-18 07:24:29 UTC (rev 102) +++ trunk/spark/lib/oxygen/physicsserver/collisionhandler.h 2009-11-18 07:42:23 UTC (rev 103) @@ -24,7 +24,7 @@ #include <oxygen/sceneserver/basenode.h> #include <oxygen/oxygen_defines.h> -#include <oxygen/physicsserver/ode/odewrapper.h> +#include "odewrapper.h" namespace oxygen { Modified: trunk/spark/lib/oxygen/physicsserver/joint.h =================================================================== --- trunk/spark/lib/oxygen/physicsserver/joint.h 2009-11-18 07:24:29 UTC (rev 102) +++ trunk/spark/lib/oxygen/physicsserver/joint.h 2009-11-18 07:42:23 UTC (rev 103) @@ -23,7 +23,7 @@ #define OXYGEN_JOINT_H #include <oxygen/oxygen_defines.h> -#include <oxygen/physicsserver/ode/odeobject.h> +#include "odeobject.h" namespace oxygen { Copied: trunk/spark/lib/oxygen/physicsserver/odeobject.cpp (from rev 97, trunk/spark/lib/oxygen/physicsserver/odeobject.cpp) =================================================================== --- trunk/spark/lib/oxygen/physicsserver/odeobject.cpp (rev 0) +++ trunk/spark/lib/oxygen/physicsserver/odeobject.cpp 2009-11-18 07:42:23 UTC (rev 103) @@ -0,0 +1,167 @@ +/* -*- mode: c++; c-basic-offset: 4; indent-tabs-mode: nil -*- + + this file is part of rcssserver3D + Fri May 9 2003 + Copyright (C) 2002,2003 Koblenz University + Copyright (C) 2003 RoboCup Soccer Server 3D Maintenance Group + $Id$ + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; version 2 of the License. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +*/ +#include "odeobject.h" +#include "space.h" +#include "world.h" +#include <oxygen/sceneserver/scene.h> +#include <zeitgeist/logserver/logserver.h> + +using namespace oxygen; +using namespace boost; + +ODEObject::ODEObject() : BaseNode() +{ +} + +ODEObject::~ODEObject() +{ +} + +void ODEObject::OnUnlink() +{ + DestroyODEObject(); +} + +/** returns the world node */ +shared_ptr<World> ODEObject::GetWorld() +{ + shared_ptr<Scene> scene = GetScene(); + if (scene.get() == 0) + { + GetLog()->Error() << "(ODEObject) ERROR: found no Scene node\n"; + return shared_ptr<World>(); + } + + shared_ptr<World> worldNode = shared_dynamic_cast<World> + (scene->GetChildOfClass("World")); + if (worldNode.get() == 0) + { + GetLog()->Error() << "(ODEObject) ERROR: found no World node\n"; + } + + return worldNode; +} + +shared_ptr<Space> ODEObject::GetSpace() +{ + // try to find the nearest parent space object + weak_ptr<Space> parentSpace = FindParentSupportingClass<Space>(); + if (! parentSpace.expired()) + { + return parentSpace.lock(); + } + + // return the global space instance + shared_ptr<Scene> scene = GetScene(); + if (scene.get() == 0) + { + GetLog()->Error() << "(ODEObject) ERROR: found no Scene node\n"; + return shared_ptr<Space>(); + } + + shared_ptr<Space> spaceNode = shared_dynamic_cast<Space> + (scene->GetChildOfClass("Space")); + if (spaceNode.get() == 0) + { + GetLog()->Error() << "(ODEObject) ERROR: found no Space node\n"; + } + + return spaceNode; +} + +dWorldID ODEObject::GetWorldID() +{ + shared_ptr<World> world = GetWorld(); + if (world.get() == 0) + { + return 0; + } + + dWorldID worldId = world->GetODEWorld(); + if (worldId == 0) + { + GetLog()->Error() + << "(ODEObject) ERROR: World returned empty ODE handle\n"; + } + + return worldId; +} + +dSpaceID ODEObject::FindSpaceID() +{ + shared_ptr<Space> space = GetSpace(); + if (space.get() == 0) + { + return 0; + } + + dSpaceID spaceId = space->GetODESpace(); + + if (spaceId == 0) + { + GetLog()->Error() + << "(ODEObject) ERROR: Space returned empty ODE handle\n"; + } + + return spaceId; +} + +dSpaceID ODEObject::GetParentSpaceID() +{ + return 0; +} + +void ODEObject::ConvertRotationMatrix(const salt::Matrix& rot, dMatrix3& matrix) +{ + matrix[0] = rot.m[0]; + matrix[1] = rot.m[4]; + matrix[2] = rot.m[8]; + matrix[3] = 0; + matrix[4] = rot.m[1]; + matrix[5] = rot.m[5]; + matrix[6] = rot.m[9]; + matrix[7] = 0; + matrix[8] = rot.m[2]; + matrix[9] = rot.m[6]; + matrix[10] = rot.m[10]; + matrix[11] = 0; +} + +void ODEObject::ConvertRotationMatrix(const dReal* matrix, salt::Matrix& rot) const +{ + rot.m[0] = matrix[0] ; + rot.m[4] = matrix[1] ; + rot.m[8] = matrix[2]; + rot.m[12] = matrix[3]; + rot.m[1] = matrix[4]; + rot.m[5] = matrix[5]; + rot.m[9] = matrix[6]; + rot.m[13] = matrix[7]; + rot.m[2] = matrix[8]; + rot.m[6] = matrix[9]; + rot.m[10] = matrix[10] ; + rot.m[14] = matrix[11]; + rot.m[3] = 0.0; + rot.m[7] = 0.0; + rot.m[11] = 0.0; + rot.m[15] = 1.0; +} Copied: trunk/spark/lib/oxygen/physicsserver/odeobject.h (from rev 97, trunk/spark/lib/oxygen/physicsserver/odeobject.h) =================================================================== --- trunk/spark/lib/oxygen/physicsserver/odeobject.h (rev 0) +++ trunk/spark/lib/oxygen/physicsserver/odeobject.h 2009-11-18 07:42:23 UTC (rev 103) @@ -0,0 +1,83 @@ +/* -*- mode: c++; c-basic-offset: 4; indent-tabs-mode: nil -*- + + this file is part of rcssserver3D + Fri May 9 2003 + Copyright (C) 2002,2003 Koblenz University + Copyright (C) 2003 RoboCup Soccer Server 3D Maintenance Group + $Id$ + $Id$ + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; version 2 of the License. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +*/ +#ifndef OXYGEN_ODEOBJECT_H +#define OXYGEN_ODEOBJECT_H + +#include <oxygen/oxygen_defines.h> +#include <oxygen/sceneserver/basenode.h> +#include "odewrapper.h" + +namespace oxygen +{ +class Space; +class World; + +/** ODEObject is the base of all classes encapsulating ODE concepts + */ +class OXYGEN_API ODEObject : public BaseNode +{ +public: + // + // Functions + // + ODEObject(); + virtual ~ODEObject(); + + /** This rountine is called, before the hierarchy object is + removed from the parent. It can be overridden to support + custom 'unlink' behavior. + */ + virtual void OnUnlink(); + + /** returns the ODE world handle */ + dWorldID GetWorldID(); + + /** returns the nearest parent space ODE handle */ + dSpaceID FindSpaceID(); + + /** returns the ODE handle ID of the containing parent space */ + virtual dSpaceID GetParentSpaceID(); + + /** destroy the managed ODE object */ + virtual void DestroyODEObject() = 0; + +protected: + /** returns the world node */ + boost::shared_ptr<World> GetWorld(); + + /** finds the nearest parent space node */ + boost::shared_ptr<Space> GetSpace(); + + /** converts the rotation part of a salt::Matrix to an ODE + dMatrix3 */ + void ConvertRotationMatrix(const salt::Matrix& rot, dMatrix3& matrix); + + /** coverts the ODE dMatrix3 to the rotation part of a salt::Matrix */ + void ConvertRotationMatrix(const dReal* matrix, salt::Matrix& rot) const; +}; + +DECLARE_ABSTRACTCLASS(ODEObject); + +} //namespace oxygen + +#endif //OXYGEN_ODEOBJECT_H Copied: trunk/spark/lib/oxygen/physicsserver/odeobject_c.cpp (from rev 97, trunk/spark/lib/oxygen/physicsserver/odeobject_c.cpp) =================================================================== --- trunk/spark/lib/oxygen/physicsserver/odeobject_c.cpp (rev 0) +++ trunk/spark/lib/oxygen/physicsserver/odeobject_c.cpp 2009-11-18 07:42:23 UTC (rev 103) @@ -0,0 +1,29 @@ +/* -*- mode: c++ -*- + + this file is part of rcssserver3D + Fri May 9 2003 + Copyright (C) 2003 Koblenz University + $Id$ + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; version 2 of the License. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +*/ + +#include "odeobject.h" + +using namespace oxygen; + +void CLASS(ODEObject)::DefineClass() +{ + DEFINE_BASECLASS(oxygen/BaseNode); +} Copied: trunk/spark/lib/oxygen/physicsserver/odewrapper.h (from rev 97, trunk/spark/lib/oxygen/physicsserver/odewrapper.h) =================================================================== --- trunk/spark/lib/oxygen/physicsserver/odewrapper.h (rev 0) +++ trunk/spark/lib/oxygen/physicsserver/odewrapper.h 2009-11-18 07:42:23 UTC (rev 103) @@ -0,0 +1,80 @@ +/* -*- mode: c++; c-basic-offset: 4; indent-tabs-mode: nil -*- + + this file is part of rcssserver3D + Fri May 9 2003 + Copyright (C) 2002,2003 Koblenz University + Copyright (C) 2003 RoboCup Soccer Server 3D Maintenance Group + $Id$ + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; version 2 of the License. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +*/ +#ifndef OXYGEN_ODEWRAPPER_H +#define OXYGEN_ODEWRAPPER_H + +#undef EXTERN +#undef HAVE_VPRINTF +#undef PACKAGE +#undef PACKAGE_BUGREPORT +#undef PACKAGE_NAME +#undef PACKAGE_STRING +#undef PACKAGE_TARNAME +#undef PACKAGE_VERSION +#undef PREFIX +#undef VERSION + +#ifdef WIN32 + +#ifdef copysignf +#undef copysignf +#endif + +#ifdef copysign +#undef copysign +#endif + +#endif // WIN32 + +#ifdef __APPLE__ + +// there is a conflicting type in a system header (Leopard) +// so we define a dummy here +#define uint32 dummy + +#endif + +#include <ode/ode.h> + +#ifdef __APPLE__ + +// undefine the dummy +#undef uint32 + +#endif + +#undef EXTERN +#undef HAVE_VPRINTF +#undef PACKAGE +#undef PACKAGE_BUGREPORT +#undef PACKAGE_NAME +#undef PACKAGE_STRING +#undef PACKAGE_TARNAME +#undef PACKAGE_VERSION +#undef PREFIX +#undef VERSION + +#ifdef HAVE_CONFIG_H +#include <sparkconfig.h> +#endif + +#endif // OXYGEN_ODEWRAPPER Modified: trunk/spark/lib/oxygen/physicsserver/physicsserver.h =================================================================== --- trunk/spark/lib/oxygen/physicsserver/physicsserver.h 2009-11-18 07:24:29 UTC (rev 102) +++ trunk/spark/lib/oxygen/physicsserver/physicsserver.h 2009-11-18 07:42:23 UTC (rev 103) @@ -25,7 +25,7 @@ #include <zeitgeist/class.h> #include <zeitgeist/leaf.h> #include <oxygen/oxygen_defines.h> -#include <oxygen/physicsserver/ode/odewrapper.h> +#include "odewrapper.h" namespace oxygen { Modified: trunk/spark/lib/oxygen/physicsserver/space.h =================================================================== --- trunk/spark/lib/oxygen/physicsserver/space.h 2009-11-18 07:24:29 UTC (rev 102) +++ trunk/spark/lib/oxygen/physicsserver/space.h 2009-11-18 07:42:23 UTC (rev 103) @@ -22,7 +22,7 @@ #ifndef OXYGEN_SPACE_H #define OXYGEN_SPACE_H -#include <oxygen/physicsserver/ode/odeobject.h> +#include "odeobject.h" #include <set> #include <oxygen/oxygen_defines.h> Modified: trunk/spark/lib/oxygen/physicsserver/world.cpp =================================================================== --- trunk/spark/lib/oxygen/physicsserver/world.cpp 2009-11-18 07:24:29 UTC (rev 102) +++ trunk/spark/lib/oxygen/physicsserver/world.cpp 2009-11-18 07:42:23 UTC (rev 103) @@ -19,19 +19,16 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ -#include <oxygen/physicsserver/ode/odeworld.h> -#include <oxygen/physicsserver/world.h> -#include <oxygen/physicsserver/space.h> +#include "world.h" +#include "space.h" #include <oxygen/sceneserver/scene.h> using namespace boost; using namespace oxygen; using namespace salt; -World::World() : ODEObject() +World::World() : ODEObject(), mODEWorld(0) { - shared_ptr<ODEWorld> odeworld(new ODEWorld()); - mWorldImp = (shared_dynamic_cast<WorldImp>(odeworld)); } World::~World() @@ -40,70 +37,102 @@ dWorldID World::GetODEWorld() const { - return mWorldImp->GetODEWorldImp(); + return mODEWorld; } void World::SetGravity(const Vector3f& gravity) { - mWorldImp->SetGravityImp(gravity); + dWorldSetGravity(mODEWorld, + gravity.x(), + gravity.y(), + gravity.z() + ); } salt::Vector3f World::GetGravity() const { - return mWorldImp->GetGravityImp(); + dVector3 dGravity; + dWorldGetGravity(mODEWorld,dGravity); + return Vector3f(dGravity[0],dGravity[1],dGravity[2]); } void World::SetERP(float erp) { - mWorldImp->SetERPImp(erp); + dWorldSetERP(mODEWorld, erp); } float World::GetERP() const { - return mWorldImp->GetERPImp(); + return dWorldGetERP(mODEWorld); } void World::SetCFM(float cfm) { - mWorldImp->SetCFMImp(cfm); + dWorldSetCFM(mODEWorld, cfm); } float World::GetCFM() const { - return mWorldImp->GetCFMImp(); + return dWorldGetCFM(mODEWorld); } void World::Step(float deltaTime) { - mWorldImp->StepImp(deltaTime); + dWorldStep(mODEWorld, deltaTime); } bool World::GetAutoDisableFlag() const { - return mWorldImp->GetAutoDisableFlagImp(); + return (dWorldGetAutoDisableFlag(mODEWorld) == 1); } void World::SetAutoDisableFlag(bool flag) { - mWorldImp->SetAutoDisableFlagImp(flag); + dWorldSetAutoDisableFlag(mODEWorld, static_cast<int>(flag)); } void World::SetContactSurfaceLayer(float depth) { - mWorldImp->SetContactSurfaceLayerImp(depth); + dWorldSetContactSurfaceLayer(mODEWorld, depth); } float World::GetContactSurfaceLayer() const { - return mWorldImp->GetContactSurfaceLayerImp(); + return dWorldGetContactSurfaceLayer(mODEWorld); } bool World::ConstructInternal() { - return mWorldImp->ConstructInternalImp(); + // create an ode world + mODEWorld = dWorldCreate(); + + return (mODEWorld != 0); } void World::DestroyODEObject() { - mWorldImp->DestroyODEObjectImp(); + static bool recurseLock = false; + if (recurseLock) + { + return; + } + + recurseLock = true; + + shared_ptr<Space> space = GetSpace(); + if (space.get() != 0) + { + space->DestroyODEObject(); + } + + if (mODEWorld == 0) + { + return; + } + + // release the ODE world + dWorldDestroy(mODEWorld); + mODEWorld = 0; + + recurseLock = false; } Modified: trunk/spark/lib/oxygen/physicsserver/world.h =================================================================== --- trunk/spark/lib/oxygen/physicsserver/world.h 2009-11-18 07:24:29 UTC (rev 102) +++ trunk/spark/lib/oxygen/physicsserver/world.h 2009-11-18 07:42:23 UTC (rev 103) @@ -23,14 +23,11 @@ #define OXYGEN_WORLD_H #include <oxygen/oxygen_defines.h> -#include <oxygen/physicsserver/ode/odeobject.h> +#include "odeobject.h" namespace oxygen { -class WorldImp; -class ODEWorld; - /** World encapsulates an ODE world object. It is a container for rigid bodies and joints. Objects in different worlds can not interact, for example rigid bodies from two different worlds can @@ -116,11 +113,12 @@ // Members // private: - boost::shared_ptr<WorldImp> mWorldImp; + /** the dynamics world represented by this object */ + dWorldID mODEWorld; }; DECLARE_CLASS(World); -} +}; #endif //OXYGEN_WORLD_H Modified: trunk/spark/lib/oxygen/physicsserver/world_c.cpp =================================================================== --- trunk/spark/lib/oxygen/physicsserver/world_c.cpp 2009-11-18 07:24:29 UTC (rev 102) +++ trunk/spark/lib/oxygen/physicsserver/world_c.cpp 2009-11-18 07:42:23 UTC (rev 103) @@ -19,7 +19,7 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ -#include <oxygen/physicsserver/world.h> +#include "world.h" using namespace boost; using namespace oxygen; Modified: trunk/spark/plugin/collisionperceptor/forceresistanceperceptor.cpp =================================================================== --- trunk/spark/plugin/collisionperceptor/forceresistanceperceptor.cpp 2009-11-18 07:24:29 UTC (rev 102) +++ trunk/spark/plugin/collisionperceptor/forceresistanceperceptor.cpp 2009-11-18 07:42:23 UTC (rev 103) @@ -21,7 +21,7 @@ */ #include "forceresistanceperceptor.h" -#include <oxygen/physicsserver/ode/odewrapper.h> +#include <oxygen/physicsserver/odewrapper.h> #include <oxygen/sceneserver/transform.h> using namespace std; Modified: trunk/spark/plugin/collisionperceptor/forceresistanceperceptor.h =================================================================== --- trunk/spark/plugin/collisionperceptor/forceresistanceperceptor.h 2009-11-18 07:24:29 UTC (rev 102) +++ trunk/spark/plugin/collisionperceptor/forceresistanceperceptor.h 2009-11-18 07:42:23 UTC (rev 103) @@ -24,7 +24,7 @@ #define FORCERESISTANCEPERCEPTOR_H_ #include <oxygen/agentaspect/perceptor.h> -#include <oxygen/physicsserver/ode/odewrapper.h> +#include <oxygen/physicsserver/odewrapper.h> #include <oxygen/sceneserver/transform.h> #include <salt/vector.h> #include <list> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <he...@us...> - 2009-12-29 19:07:44
|
Revision: 129 http://simspark.svn.sourceforge.net/simspark/?rev=129&view=rev Author: hedayat Date: 2009-12-29 19:07:35 +0000 (Tue, 29 Dec 2009) Log Message: ----------- Add ~/.simspark directory to resource search path Added new effector: AgentSyncEffector (syn command) Added Sync Mode to the simulator Added an option to run the server in simulation time mode instead of real time mode Modified Paths: -------------- trunk/spark/ChangeLog trunk/spark/RELEASE trunk/spark/lib/oxygen/agentaspect/agentaspect.cpp trunk/spark/lib/oxygen/agentaspect/agentaspect.h trunk/spark/lib/oxygen/simulationserver/agentcontrol.cpp trunk/spark/lib/oxygen/simulationserver/agentcontrol.h trunk/spark/lib/oxygen/simulationserver/agentcontrol_c.cpp trunk/spark/lib/oxygen/simulationserver/netcontrol.cpp trunk/spark/lib/oxygen/simulationserver/netcontrol.h trunk/spark/lib/zeitgeist/scriptserver/scriptserver.cpp trunk/spark/lib/zeitgeist/scriptserver/scriptserver.h trunk/spark/lib/zeitgeist/zeitgeist.cpp trunk/spark/plugin/CMakeLists.txt trunk/spark/spark/spark.rb Added Paths: ----------- trunk/spark/plugin/agentsynceffector/ trunk/spark/plugin/agentsynceffector/CMakeLists.txt trunk/spark/plugin/agentsynceffector/agentsynceffector.cpp trunk/spark/plugin/agentsynceffector/agentsynceffector.h trunk/spark/plugin/agentsynceffector/agentsynceffector_c.cpp trunk/spark/plugin/agentsynceffector/export.cpp Modified: trunk/spark/ChangeLog =================================================================== --- trunk/spark/ChangeLog 2009-12-25 14:26:51 UTC (rev 128) +++ trunk/spark/ChangeLog 2009-12-29 19:07:35 UTC (rev 129) @@ -1,3 +1,46 @@ +2009-12-29 Hedayat Vatankhah <he...@gr...> + + * lib/zeitgeist/zeitgeist.cpp (Zeitgeist::RunInitScript): + - call SetupDotDir() so that ~/.simspark directory will be searched for + resource files (e.g. scripts) + + * lib/zeitgeist/scriptserver/scriptserver.h: + * lib/zeitgeist/scriptserver/scriptserver.cpp: + - added SetupDotDir() function to create dot dir and add it to resource + search locations + + * lib/oxygen/simulationserver/netcontrol.h: + * lib/oxygen/simulationserver/netcontrol.cpp: + - added the option to block for awhile (1 second) in ReadMessages if no + messages are available + + * spark/spark.rb: + - added new option useRealTime to select between running in real time and + simulation time running modes + - added new option agentSyncMode which can be set to run in sync mode + - loading agentsynceffector module + + * lib/oxygen/simulationserver/agentcontrol.h: + * lib/oxygen/simulationserver/agentcontrol.cpp: + * lib/oxygen/simulationserver/agentcontrol_c.cpp: + - added "Sync mode" in which agentcontrol will block until all connected + agents tell it to proceed + + * plugin/agentsynceffector/CMakeLists.txt: + * plugin/agentsynceffector/export.cpp: + * plugin/agentsynceffector/agentsynceffector.h: + * plugin/agentsynceffector/agentsynceffector.cpp: + * plugin/agentsynceffector/agentsynceffector_c.cpp: + * plugin/CMakeLists.txt: + - a new effector: AgentSyncEffector + + * lib/oxygen/agentaspect/agentaspect.h: + * lib/oxygen/agentaspect/agentaspect.cpp: + - added mIsSynced property to show if the agent is synced with the server + + * RELEASE: + - some new release notes + 2009-10-31 Hedayat Vatankhah <he...@gr...> * lib/oxygen/simulationserver/simulationserver.h: Modified: trunk/spark/RELEASE =================================================================== --- trunk/spark/RELEASE 2009-12-25 14:26:51 UTC (rev 128) +++ trunk/spark/RELEASE 2009-12-29 19:07:35 UTC (rev 129) @@ -11,7 +11,19 @@ sense data of the last cycle. So, any commands which is sent by agents after receiving new sense data will be executed in the next cycle, not the current one. This results in a more deterministic behavior, and agents' - efficiency should not change between remote and local runs considerably. + efficiency should not change between remote and local runs considerably. + - An Accelerometer sensor + - Fixed some rendering bugs (agents not visible through goals) + - A "Sync Mode" operation is introduced. In this mode, the server will not + advance to the next cycle untill all connected agents send a "syn" command + to the server. You can use this mode by setting "agentSyncMode" to true in + simspark.rb (or spark.rb) + - Simulator will run in simulation time mode instead of real time + if "useRealTime" variable is set to false in simspark.rb (or spark.rb) + - To make changes to most of the resource files (e.g. simspark.rb), you can + create a copy in ~/.simspark directory and make desired changes there. The + directory structure of the original files should be preserved (e.g. + rsg/agent/nao/nao.rgs) You can get the package on the Simspark page on SourceForge at http://sourceforge.net/projects/simspark/ Modified: trunk/spark/lib/oxygen/agentaspect/agentaspect.cpp =================================================================== --- trunk/spark/lib/oxygen/agentaspect/agentaspect.cpp 2009-12-25 14:26:51 UTC (rev 128) +++ trunk/spark/lib/oxygen/agentaspect/agentaspect.cpp 2009-12-29 19:07:35 UTC (rev 129) @@ -27,7 +27,7 @@ using namespace salt; using namespace std; -AgentAspect::AgentAspect() : Transform() +AgentAspect::AgentAspect() : Transform(), mIsSynced(true) { SetName("agentAspect"); mID = -1; @@ -168,3 +168,8 @@ return added; } + +bool AgentAspect::IsSynced() const +{ + return mIsSynced || mPerceptorCycle < 5; +} Modified: trunk/spark/lib/oxygen/agentaspect/agentaspect.h =================================================================== --- trunk/spark/lib/oxygen/agentaspect/agentaspect.h 2009-12-25 14:26:51 UTC (rev 128) +++ trunk/spark/lib/oxygen/agentaspect/agentaspect.h 2009-12-29 19:07:35 UTC (rev 129) @@ -68,6 +68,12 @@ //! @return the unique ID for the agent aspect inline int ID() const { return mID; } + /** @return if the agent is in sync with the server in Sync mode*/ + bool IsSynced() const; + + /** sets the synchronization status of the agent */ + void SetSynced(bool synced) { mIsSynced = synced; } + protected: typedef std::map<std::string, boost::shared_ptr<Effector> > TEffectorMap; @@ -76,9 +82,12 @@ private: int mID; + /** indicates how many times the QueryPerceptors be called */ unsigned int mPerceptorCycle; + /** show if the agent is in sync with the server (in Sync mode) */ + bool mIsSynced; }; DECLARE_CLASS(AgentAspect); Modified: trunk/spark/lib/oxygen/simulationserver/agentcontrol.cpp =================================================================== --- trunk/spark/lib/oxygen/simulationserver/agentcontrol.cpp 2009-12-25 14:26:51 UTC (rev 128) +++ trunk/spark/lib/oxygen/simulationserver/agentcontrol.cpp 2009-12-29 19:07:35 UTC (rev 129) @@ -20,6 +20,7 @@ #include "agentcontrol.h" #include "simulationserver.h" #include "netmessage.h" +#include <set> #include <zeitgeist/logserver/logserver.h> #include <oxygen/agentaspect/agentaspect.h> @@ -28,7 +29,7 @@ using namespace boost; using namespace std; -AgentControl::AgentControl() : NetControl() +AgentControl::AgentControl() : NetControl(), mSyncMode(false) { mLocalAddr.setPort(3100); } @@ -77,57 +78,60 @@ void AgentControl::StartCycle() { - NetControl::StartCycle(); + do + { + NetControl::StartCycle(); - if ( - (mGameControlServer.get() == 0) || - (mNetMessage.get() == 0) - ) - { - return; - } + if ( + (mGameControlServer.get() == 0) || + (mNetMessage.get() == 0) + ) + { + return; + } - // pass all received messages on to the GameControlServer - for ( - TBufferMap::iterator iter = mBuffers.begin(); - iter != mBuffers.end(); - ++iter - ) - { - shared_ptr<NetBuffer>& netBuff = (*iter).second; - if ( - (netBuff.get() == 0) || - (netBuff->IsEmpty()) - ) - { - continue; - } + // pass all received messages on to the GameControlServer + for ( + TBufferMap::iterator iter = mBuffers.begin(); + iter != mBuffers.end(); + ++iter + ) + { + shared_ptr<NetBuffer>& netBuff = (*iter).second; + if ( + (netBuff.get() == 0) || + (netBuff->IsEmpty()) + ) + { + continue; + } - // lookup the client entry corresponding for the buffer - // entry - TAddrMap::iterator clientIter = mClients.find(netBuff->GetAddr()); - if (clientIter == mClients.end()) - { - continue; - } - shared_ptr<Client>& client = (*clientIter).second; + // lookup the client entry corresponding for the buffer + // entry + TAddrMap::iterator clientIter = mClients.find(netBuff->GetAddr()); + if (clientIter == mClients.end()) + { + continue; + } + shared_ptr<Client>& client = (*clientIter).second; - // lookup the AgentAspect node correspoding to the client - shared_ptr<AgentAspect> agent = - mGameControlServer->GetAgentAspect(client->id); - if (agent.get() == 0) - { - continue; - } + // lookup the AgentAspect node correspoding to the client + shared_ptr<AgentAspect> agent = + mGameControlServer->GetAgentAspect(client->id); + if (agent.get() == 0) + { + continue; + } - // parse and immediately realize the action - string message; - while (mNetMessage->Extract(netBuff,message)) - { - agent->RealizeActions - (mGameControlServer->Parse(client->id,message)); - } - } + // parse and immediately realize the action + string message; + while (mNetMessage->Extract(netBuff,message)) + { + agent->RealizeActions + (mGameControlServer->Parse(client->id,message)); + } + } + } while (!AgentsAreSynced()); } void AgentControl::SenseAgent() @@ -184,6 +188,10 @@ { continue; } + if (mSyncMode) + { + agent->SetSynced(false); + } shared_ptr<PredicateList> senseList = agent->QueryPerceptors(); mClientSenses[client->id] = parser->Generate(senseList); @@ -195,3 +203,47 @@ mNetMessage->PrepareToSend(mClientSenses[client->id]); } } + +void AgentControl::SetSyncMode(bool syncMode) +{ + mSyncMode = syncMode; + if (mSyncMode) + { + BlockOnReadMessages(true); + GetLog()->Normal() + << "(AgentControl) Running in sync mode.\n"; + } + else + { + BlockOnReadMessages(false); + GetLog()->Normal() + << "(AgentControl) Running in normal mode.\n"; + } +} + +bool AgentControl::AgentsAreSynced() +{ + if (mSyncMode) + { + set<rcss::net::Addr> closedClients(mCloseClients.begin(), + mCloseClients.end()); + + for ( + TAddrMap::const_iterator iter = mClients.begin(); + iter != mClients.end(); + ++iter + ) + { + if (closedClients.find(iter->first) != closedClients.end()) + continue; + + shared_ptr<AgentAspect> agent = + mGameControlServer->GetAgentAspect(iter->second->id); + if (agent && !agent->IsSynced()) + { + return false; + } + } + } + return true; +} Modified: trunk/spark/lib/oxygen/simulationserver/agentcontrol.h =================================================================== --- trunk/spark/lib/oxygen/simulationserver/agentcontrol.h 2009-12-25 14:26:51 UTC (rev 128) +++ trunk/spark/lib/oxygen/simulationserver/agentcontrol.h 2009-12-29 19:07:35 UTC (rev 129) @@ -53,14 +53,28 @@ /** generates sense updates for all connected agents */ virtual void EndCycle(); + /** sets the AgentControl's sync mode */ + void SetSyncMode(bool syncMode); + protected: virtual void OnLink(); + /** returns if the agents are synced with the srever */ + bool AgentsAreSynced(); + protected: /** cached reference to the GameControlServer */ CachedPath<GameControlServer> mGameControlServer; + /** stores sense information to be sent to the clients after receiving + * their commands + */ std::vector<std::string> mClientSenses; + + /** indicates if we should wait for the agents to let the simulation + * proceed to the next cycle + */ + bool mSyncMode; }; DECLARE_CLASS(AgentControl); Modified: trunk/spark/lib/oxygen/simulationserver/agentcontrol_c.cpp =================================================================== --- trunk/spark/lib/oxygen/simulationserver/agentcontrol_c.cpp 2009-12-25 14:26:51 UTC (rev 128) +++ trunk/spark/lib/oxygen/simulationserver/agentcontrol_c.cpp 2009-12-29 19:07:35 UTC (rev 129) @@ -22,7 +22,21 @@ using namespace oxygen; using namespace std; +FUNCTION(AgentControl, setSyncMode) +{ + bool inSet; + + if ((in.GetSize() != 1) || (!in.GetValue(in[0], inSet))) + { + return false; + } + + obj->SetSyncMode(inSet); + return true; +} + void CLASS(AgentControl)::DefineClass() { DEFINE_BASECLASS(oxygen/NetControl); + DEFINE_FUNCTION(setSyncMode); } Modified: trunk/spark/lib/oxygen/simulationserver/netcontrol.cpp =================================================================== --- trunk/spark/lib/oxygen/simulationserver/netcontrol.cpp 2009-12-25 14:26:51 UTC (rev 128) +++ trunk/spark/lib/oxygen/simulationserver/netcontrol.cpp 2009-12-29 19:07:35 UTC (rev 129) @@ -43,6 +43,7 @@ mSocketType = ST_TCP; mLocalAddr = Addr(INADDR_ANY, INADDR_ANY); mClientId = 1; + mReadTimeout = 0; } NetControl::~NetControl() @@ -512,7 +513,7 @@ FD_SET(fd,&readfds); timeval time; - time.tv_sec = 0; + time.tv_sec = mReadTimeout; time.tv_usec = 0; for(;;) @@ -525,6 +526,7 @@ #endif int ret = select(maxFd, &readfds, 0, 0, &time); + time.tv_sec = 0; if (ret == 0) { @@ -596,14 +598,16 @@ } // test for pending fragments + int timeout = mReadTimeout; for(;;) { timeval time; - time.tv_sec = 0; + time.tv_sec = timeout; time.tv_usec = 0; fd_set test_fds = client_fds; int ret = select(maxFd+1, &test_fds, 0, 0, &time); + timeout = 0; if (ret == 0) { @@ -660,3 +664,15 @@ } } } + +void NetControl::BlockOnReadMessages(bool block) +{ + if (block) + { + mReadTimeout = 1; + } + else + { + mReadTimeout = 0; + } +} Modified: trunk/spark/lib/oxygen/simulationserver/netcontrol.h =================================================================== --- trunk/spark/lib/oxygen/simulationserver/netcontrol.h 2009-12-25 14:26:51 UTC (rev 128) +++ trunk/spark/lib/oxygen/simulationserver/netcontrol.h 2009-12-29 19:07:35 UTC (rev 129) @@ -124,6 +124,11 @@ static boost::shared_ptr<rcss::net::Socket> CreateSocket(ESocketType type); + /** if set true, ReadMessages call will not return immediately if there + * is no messages to read and it'll wait a little for incomming messages + */ + void BlockOnReadMessages(bool block); + protected: /** returns a human readable description of the socket type and port*/ @@ -198,6 +203,9 @@ /** the next available unique client id */ int mClientId; + + /** indicates how much ReadMessages should wait for new messages */ + int mReadTimeout; }; DECLARE_CLASS(NetControl); Modified: trunk/spark/lib/zeitgeist/scriptserver/scriptserver.cpp =================================================================== --- trunk/spark/lib/zeitgeist/scriptserver/scriptserver.cpp 2009-12-25 14:26:51 UTC (rev 128) +++ trunk/spark/lib/zeitgeist/scriptserver/scriptserver.cpp 2009-12-29 19:07:35 UTC (rev 129) @@ -445,6 +445,18 @@ } bool +ScriptServer::SetupDotDir() +{ + string dotDir; + if (GetDotDirName(dotDir) && CreateDotDir(dotDir)) + { + GetFile()->AddResourceLocation(dotDir); + return true; + } + return false; +} + +bool ScriptServer::ConstructInternal() { if (! Leaf::ConstructInternal()) Modified: trunk/spark/lib/zeitgeist/scriptserver/scriptserver.h =================================================================== --- trunk/spark/lib/zeitgeist/scriptserver/scriptserver.h 2009-12-25 14:26:51 UTC (rev 128) +++ trunk/spark/lib/zeitgeist/scriptserver/scriptserver.h 2009-12-29 19:07:35 UTC (rev 129) @@ -144,6 +144,9 @@ /** returns the context, the ScriptServer operates in */ boost::shared_ptr<CoreContext> GetContext() const; + /** creates dot directory and adds it to resource search paths */ + bool SetupDotDir(); + /** constructs the ZeitgeistObject corresponding to a given leaf */ static GCValue GetZeitgeistObject(boost::shared_ptr<Leaf> leaf); Modified: trunk/spark/lib/zeitgeist/zeitgeist.cpp =================================================================== --- trunk/spark/lib/zeitgeist/zeitgeist.cpp 2009-12-25 14:26:51 UTC (rev 128) +++ trunk/spark/lib/zeitgeist/zeitgeist.cpp 2009-12-29 19:07:35 UTC (rev 129) @@ -72,6 +72,7 @@ // setup the dot directory in the script server mCore->GetScriptServer()->SetDotName(dotName); + mCore->GetScriptServer()->SetupDotDir(); // run the zeitgeist init script mCore->GetScriptServer()->RunInitScript Modified: trunk/spark/plugin/CMakeLists.txt =================================================================== --- trunk/spark/plugin/CMakeLists.txt 2009-12-25 14:26:51 UTC (rev 128) +++ trunk/spark/plugin/CMakeLists.txt 2009-12-29 19:07:35 UTC (rev 129) @@ -10,6 +10,7 @@ endif (APPLE AND USE_COREFOUNDATION) add_subdirectory(accelerometer) +add_subdirectory(agentsynceffector) add_subdirectory(filesystemstd) add_subdirectory(filesystemzip) add_subdirectory(forceeffector) Added: trunk/spark/plugin/agentsynceffector/CMakeLists.txt =================================================================== --- trunk/spark/plugin/agentsynceffector/CMakeLists.txt (rev 0) +++ trunk/spark/plugin/agentsynceffector/CMakeLists.txt 2009-12-29 19:07:35 UTC (rev 129) @@ -0,0 +1,19 @@ + +########### next target ############### + +set(agentsynceffector_LIB_SRCS + export.cpp + agentsynceffector.cpp + agentsynceffector.h + agentsynceffector_c.cpp +) + +add_library(agentsynceffector MODULE ${agentsynceffector_LIB_SRCS}) + +target_link_libraries(agentsynceffector ${spark_libs}) + +if (NOT APPLE) + set_target_properties(agentsynceffector PROPERTIES VERSION 0.0.0 SOVERSION 0) +endif (NOT APPLE) + +install(TARGETS agentsynceffector DESTINATION ${LIBDIR}/${CMAKE_PROJECT_NAME}) Added: trunk/spark/plugin/agentsynceffector/agentsynceffector.cpp =================================================================== --- trunk/spark/plugin/agentsynceffector/agentsynceffector.cpp (rev 0) +++ trunk/spark/plugin/agentsynceffector/agentsynceffector.cpp 2009-12-29 19:07:35 UTC (rev 129) @@ -0,0 +1,87 @@ +/* -*- mode: c++; c-basic-indent: 4; indent-tabs-mode: nil -*- + + this file is part of rcssserver3D + Fri May 9 2003 + Copyright (C) 2002,2003 Koblenz University + Copyright (C) 2003 RoboCup Soccer Server 3D Maintenance Group + $Id: forceeffector.cpp 19 2008-12-19 18:12:56Z hedayat $ + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; version 2 of the License. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +*/ + +#include "agentsynceffector.h" +#include <zeitgeist/logserver/logserver.h> +#include <oxygen/gamecontrolserver/actionobject.h> +#include <oxygen/agentaspect/agentaspect.h> + +using namespace boost; +using namespace oxygen; + +AgentSyncEffector::AgentSyncEffector() : oxygen::Effector() +{ +} + +AgentSyncEffector::~AgentSyncEffector() +{ +} + +bool AgentSyncEffector::Realize(boost::shared_ptr<ActionObject> action) +{ + bool res = Effector::Realize(action); + + if (mAgentAspect) + { + mAgentAspect->SetSynced(true); + } + return res; +} + +shared_ptr<ActionObject> +AgentSyncEffector::GetActionObject(const Predicate& predicate) +{ + if (predicate.name != GetPredicate()) + { + GetLog()->Error() << "ERROR: (AgentSyncEffector) invalid predicate" + << predicate.name << "\n"; + return shared_ptr<ActionObject>(); + } + + return shared_ptr<ActionObject>(new ActionObject(GetPredicate())); +} + +void AgentSyncEffector::OnLink() +{ + mAgentAspect = GetAgentAspect(); + + if (mAgentAspect.get() == 0) + { + GetLog()->Error() + << "ERROR: (AgentSyncEffector) cannot get the AgentAspect object\n"; + return; + } + + mAgentAspect = mAgentAspect->FindParentSupportingClass<AgentAspect>().lock(); + if (mAgentAspect.get() == 0) + { + GetLog()->Error() + << "ERROR: (AgentSyncEffector) cannot get the grand parent AgentAspect" + " object\n"; + return; + } +} + +void AgentSyncEffector::OnUnlink() +{ + mAgentAspect.reset(); +} Added: trunk/spark/plugin/agentsynceffector/agentsynceffector.h =================================================================== --- trunk/spark/plugin/agentsynceffector/agentsynceffector.h (rev 0) +++ trunk/spark/plugin/agentsynceffector/agentsynceffector.h 2009-12-29 19:07:35 UTC (rev 129) @@ -0,0 +1,55 @@ +/* -*- mode: c++; c-basic-offset: 4; indent-tabs-mode: nil -*- + + this file is part of rcssserver3D + Fri May 9 2003 + Copyright (C) 2002,2003 Koblenz University + Copyright (C) 2003 RoboCup Soccer Server 3D Maintenance Group + $Id$ + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; version 2 of the License. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +*/ +#ifndef AGENTSYNCEFFECTOR_H +#define AGENTSYNCEFFECTOR_H + +#include <oxygen/agentaspect/effector.h> + +class AgentSyncEffector : public oxygen::Effector +{ +public: + AgentSyncEffector(); + virtual ~AgentSyncEffector(); + + /** realize the sync action asap */ + virtual bool Realize(boost::shared_ptr<oxygen::ActionObject> action); + + /** returns the name of the predicate this effector implements. */ + virtual std::string GetPredicate() { return "syn"; } + + /** constructs an Actionobject, describing a predicate */ + virtual boost::shared_ptr<oxygen::ActionObject> + GetActionObject(const oxygen::Predicate& predicate); + + /** setup the reference to the agent aspect node */ + virtual void OnLink(); + + /** remove the reference to the agent aspect node */ + virtual void OnUnlink(); + +private: + boost::shared_ptr<oxygen::AgentAspect> mAgentAspect; +}; + +DECLARE_CLASS(AgentSyncEffector); + +#endif // AGENTSYNCEFFECTOR_H Added: trunk/spark/plugin/agentsynceffector/agentsynceffector_c.cpp =================================================================== --- trunk/spark/plugin/agentsynceffector/agentsynceffector_c.cpp (rev 0) +++ trunk/spark/plugin/agentsynceffector/agentsynceffector_c.cpp 2009-12-29 19:07:35 UTC (rev 129) @@ -0,0 +1,31 @@ +/* -*- mode: c++; c-basic-indent: 4; indent-tabs-mode: nil -*- + + this file is part of rcssserver3D + Fri May 9 2003 + Copyright (C) 2002,2003 Koblenz University + Copyright (C) 2003 RoboCup Soccer Server 3D Maintenance Group + $Id$ + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; version 2 of the License. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +*/ + +#include "agentsynceffector.h" + +using namespace boost; +using namespace oxygen; + +void CLASS(AgentSyncEffector)::DefineClass() +{ + DEFINE_BASECLASS(oxygen/Effector); +} Added: trunk/spark/plugin/agentsynceffector/export.cpp =================================================================== --- trunk/spark/plugin/agentsynceffector/export.cpp (rev 0) +++ trunk/spark/plugin/agentsynceffector/export.cpp 2009-12-29 19:07:35 UTC (rev 129) @@ -0,0 +1,28 @@ +/* -*- mode: c++; c-basic-offset: 4; indent-tabs-mode: nil -*- + + this file is part of rcssserver3D + Fri May 9 2003 + Copyright (C) 2002,2003 Koblenz University + Copyright (C) 2003 RoboCup Soccer Server 3D Maintenance Group + $Id$ + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; version 2 of the License. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +*/ + +#include "agentsynceffector.h" +#include <zeitgeist/zeitgeist.h> + +ZEITGEIST_EXPORT_BEGIN() + ZEITGEIST_EXPORT(AgentSyncEffector); +ZEITGEIST_EXPORT_END() Modified: trunk/spark/spark/spark.rb =================================================================== --- trunk/spark/spark/spark.rb 2009-12-25 14:26:51 UTC (rev 128) +++ trunk/spark/spark/spark.rb 2009-12-29 19:07:35 UTC (rev 129) @@ -19,6 +19,9 @@ # the name of the default bundle that contains the default InputSystem $defaultInputSystemBundle = 'inputsdl' +# if simulator should run in real time rather than simulation time +$useRealTime = true + # (OpenGL rendering) # @@ -34,6 +37,7 @@ $agentStep = 0.02 $agentType = 'tcp' $agentPort = 3100 +$agentSyncMode = false # (MonitorControl) constants # @@ -294,6 +298,7 @@ if (agentControl != nil) agentControl.setServerPort($agentPort) agentControl.setStep($agentStep) + agentControl.setSyncMode($agentSyncMode) end if ($agentType == 'udp') @@ -402,6 +407,12 @@ # add the input control node simulationServer.initControlNode('kerosin/InputControl','InputControl') end + + # set timing mode (real time vs simulation time) + inputControl = get($serverPath+'simulation/InputControl') + if (inputControl != nil) + inputControl.setAdvanceTime($useRealTime) + end end def sparkSetupTrain() @@ -616,3 +627,5 @@ # importBundle "accelerometer" + +importBundle "agentsynceffector" This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <he...@us...> - 2010-01-01 22:01:12
|
Revision: 132 http://simspark.svn.sourceforge.net/simspark/?rev=132&view=rev Author: hedayat Date: 2010-01-01 22:01:05 +0000 (Fri, 01 Jan 2010) Log Message: ----------- Fixed 32bit-64bit compatibility issue. Message length is always transmitted in 4bytes. Some code cleanup Put ~/.simspark as the first resource location to be searched Add ProxyServer classes (to be used as a syncronization proxy between agents and server) Modified Paths: -------------- trunk/spark/ChangeLog trunk/spark/lib/oxygen/CMakeLists.txt trunk/spark/lib/oxygen/simulationserver/netmessage.cpp trunk/spark/lib/oxygen/simulationserver/simcontrolnode.h trunk/spark/lib/zeitgeist/fileserver/fileserver.cpp trunk/spark/lib/zeitgeist/zeitgeist.cpp Added Paths: ----------- trunk/spark/lib/oxygen/proxyserver/ trunk/spark/lib/oxygen/proxyserver/agentproxy.cpp trunk/spark/lib/oxygen/proxyserver/agentproxy.h trunk/spark/lib/oxygen/proxyserver/agentproxy_c.cpp trunk/spark/lib/oxygen/proxyserver/proxyserver.cpp trunk/spark/lib/oxygen/proxyserver/proxyserver.h trunk/spark/lib/oxygen/proxyserver/proxyserver_c.cpp Modified: trunk/spark/ChangeLog =================================================================== --- trunk/spark/ChangeLog 2009-12-29 19:52:44 UTC (rev 131) +++ trunk/spark/ChangeLog 2010-01-01 22:01:05 UTC (rev 132) @@ -1,3 +1,27 @@ +2010-01-01 Hedayat Vatankhah <he...@gr...> + + * lib/oxygen/proxyserver/proxyserver.h: + * lib/oxygen/proxyserver/proxyserver.cpp: + * lib/oxygen/proxyserver/proxyserver_c.cpp: + * lib/oxygen/proxyserver/agentproxy.h: + * lib/oxygen/proxyserver/agentproxy.cpp: + * lib/oxygen/proxyserver/agentproxy_c.cpp: + - starting the proxy server implementation + +2009-12-31 Hedayat Vatankhah <he...@gr...> + + * lib/oxygen/simulationserver/netmessage.cpp: + - payload length is now always 32bit on all platforms, to make the + protocol platform independent (fixed 32bit/64bit compatibility issue) + + * lib/zeitgeist/fileserver/fileserver.cpp: + * lib/zeitgeist/zeitgeist.cpp (Zeitgeist::RunInitScript): + - add ~/.simspark as the first resource location, so that it is the first + address examined after the current directory + + * lib/oxygen/simulationserver/simcontrolnode.h: + - remove unused mCond member variable + 2009-12-29 Hedayat Vatankhah <he...@gr...> * lib/zeitgeist/zeitgeist.cpp (Zeitgeist::RunInitScript): Modified: trunk/spark/lib/oxygen/CMakeLists.txt =================================================================== --- trunk/spark/lib/oxygen/CMakeLists.txt 2009-12-29 19:52:44 UTC (rev 131) +++ trunk/spark/lib/oxygen/CMakeLists.txt 2010-01-01 22:01:05 UTC (rev 132) @@ -71,6 +71,8 @@ monitorserver/monitoritem.h monitorserver/custommonitor.h monitorserver/monitorcmdparser.h + proxyserver/agentproxy.h + proxyserver/proxyserver.h ) if(SPADES_FOUND) set(oxygen_LIB_HDRS @@ -204,6 +206,10 @@ monitorserver/custommonitor_c.cpp monitorserver/monitorcmdparser.cpp monitorserver/monitorcmdparser_c.cpp + proxyserver/agentproxy.cpp + proxyserver/agentproxy_c.cpp + proxyserver/proxyserver.cpp + proxyserver/proxyserver_c.cpp ) if(SPADES_FOUND) set(oxygen_LIB_SRCS Added: trunk/spark/lib/oxygen/proxyserver/agentproxy.cpp =================================================================== --- trunk/spark/lib/oxygen/proxyserver/agentproxy.cpp (rev 0) +++ trunk/spark/lib/oxygen/proxyserver/agentproxy.cpp 2010-01-01 22:01:05 UTC (rev 132) @@ -0,0 +1,189 @@ +/* -*- mode: c++; c-basic-offset: 4; indent-tabs-mode: nil -*- + + this file is part of rcssserver3D + Thu Dec 31 2009 + Copyright (C) 2002,2003 Koblenz University + Copyright (C) 2004-2009 RoboCup Soccer Server 3D Maintenance Group + $Id$ + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; version 2 of the License. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +*/ +#include "agentproxy.h" +#include <rcssnet/exception.hpp> +#include <zeitgeist/logserver/logserver.h> +#include <oxygen/simulationserver/netcontrol.h> + +#ifdef HAVE_SYS_SOCKET_H +#include <sys/socket.h> +#endif + +using namespace oxygen; +using namespace zeitgeist; +using namespace std; +using namespace rcss::net; +using boost::shared_ptr; + +AgentProxy::AgentProxy(int cycleMillisecs) : Node(), + mCycleMillisecs(cycleMillisecs), mFinished(false), + mAgentBuffer(new NetBuffer) +{ +} + +AgentProxy::~AgentProxy() +{ +} + +void AgentProxy::Start(boost::shared_ptr<rcss::net::Socket> agentSocket, + rcss::net::Addr serverAddress) +{ + try + { + mAgentSocket = agentSocket; + mServerSocket = NetControl::CreateSocket(NetControl::ST_TCP); + if (!mServerSocket) + { + mFinished = true; + return; + } + GetLog()->Normal() << "(AgentProxy) '" << GetName() << "'connecting to " + << serverAddress << "\n"; + mServerSocket->connect(serverAddress); + if (mServerSocket->isConnected()) + { + cout << "(AgentProxy) '" << GetName() << "' connected successfully" + << endl; + } + + // assure that a NetMessage object is registered + mNetMessage = FindChildSupportingClass<NetMessage>(); + if (mNetMessage.get() == 0) + { + mNetMessage = shared_ptr<NetMessage>(new NetMessage()); + } + + mAgentConnectionThread = boost::thread( + &AgentProxy::AgentConnectionHandler, this); + mServerConnectionThread = boost::thread( + &AgentProxy::ServerConnectionHandler, this); + return; + } + catch (BindErr error) + { + GetLog()->Error() << "(AgentProxy) '" << GetName() + << "' failed to bind socket with '" << error.what() << "'" + << endl; + } + catch (ConnectErr error) + { + GetLog()->Error() << "(AgentProxy) '" << GetName() + << "' connection failed with: '" << error.what() << "'" << endl; + } + + // executed on error + mServerSocket->close(); + mFinished = true; +} + +void AgentProxy::Stop() +{ + mFinished = true; + mServerConnectionThread.join(); +} + +void AgentProxy::ServerConnectionHandler() +{ + string syncMsg("(sync)"); + string servermsg, agentmsg; + boost::system_time cycleFinishTime = boost::get_system_time() + + boost::posix_time::milliseconds(mCycleMillisecs); + shared_ptr<NetBuffer> netbuf(new NetBuffer); + TRawBuffer recvbuf; + + mNetMessage->PrepareToSend(syncMsg); + while (!mFinished) + { + try + { + servermsg.clear(); + boost::thread::sleep(cycleFinishTime); + + boost::mutex::scoped_lock agentBufLock(mAgentBufferMutex); + while (!mAgentBuffer->IsEmpty() && + mNetMessage->Extract(mAgentBuffer, agentmsg)) + { + mServerSocket->send(agentmsg.data(), agentmsg.size()); + } + agentBufLock.unlock(); + + mServerSocket->send(syncMsg.data(), syncMsg.size()); + do + { + int retval = mServerSocket->recv(mCycleMillisecs, + recvbuf.data(), recvbuf.size()); + if (retval > 0) + netbuf->AddFragment(string(recvbuf.data(), recvbuf.size())); + else if (retval < 0 && errno == EAGAIN) + break; + else + { + GetLog()->Error() + << "(AgentProxy) ERROR: '" << GetName() + << "' recv returned error on a client socket '" + << strerror(errno) << "' " << endl; + mFinished = true; + break; + } + } while (!mNetMessage->Extract(netbuf, servermsg)); + + if (!servermsg.empty()) + { + mNetMessage->PrepareToSend(servermsg); + mAgentSocket->send(servermsg.data(), servermsg.size(), + MSG_DONTWAIT, Socket::DONT_CHECK); + + cycleFinishTime = boost::get_system_time() + + boost::posix_time::milliseconds(mCycleMillisecs); + } + } + catch (boost::thread_interrupted e) + { + } + } + mServerSocket->close(); + mFinished = true; + mAgentConnectionThread.join(); +} + +void AgentProxy::AgentConnectionHandler() +{ + TRawBuffer recvbuf; + + while (!mFinished) + { + int retval = mAgentSocket->recv(mCycleMillisecs * 4, + recvbuf.data(), recvbuf.size()); + if (retval > 0) + { + boost::mutex::scoped_lock agentBufLock(mAgentBufferMutex); + mAgentBuffer->AddFragment(string(recvbuf.data(), recvbuf.size())); + } + else if (retval <= 0 && errno != EAGAIN) + { + GetLog()->Error() << "(AgentProxy) ERROR: '" << GetName() + << "' recv returned error on a client socket '" + << strerror(errno) << "' " << endl; + mFinished = true; + } + } +} Property changes on: trunk/spark/lib/oxygen/proxyserver/agentproxy.cpp ___________________________________________________________________ Added: svn:mime-type + text/plain Added: svn:keywords + Id Added: trunk/spark/lib/oxygen/proxyserver/agentproxy.h =================================================================== --- trunk/spark/lib/oxygen/proxyserver/agentproxy.h (rev 0) +++ trunk/spark/lib/oxygen/proxyserver/agentproxy.h 2010-01-01 22:01:05 UTC (rev 132) @@ -0,0 +1,85 @@ +/* -*- mode: c++; c-basic-offset: 4; indent-tabs-mode: nil -*- + + this file is part of rcssserver3D + Thu Dec 31 2009 + Copyright (C) 2002,2003 Koblenz University + Copyright (C) 2004-2009 RoboCup Soccer Server 3D Maintenance Group + $Id$ + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; version 2 of the License. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +*/ +#ifndef OXYGEN_AGENTPROXY_H +#define OXYGEN_AGENTPROXY_H + +#include <boost/array.hpp> +#include <boost/thread/thread.hpp> +#include <boost/thread/mutex.hpp> +#include <oxygen/oxygen_defines.h> +#include <zeitgeist/class.h> +#include <zeitgeist/node.h> +#include <rcssnet/addr.hpp> +#include <rcssnet/socket.hpp> +#include <oxygen/simulationserver/netbuffer.h> +#include <oxygen/simulationserver/netmessage.h> + +namespace oxygen +{ + +/** \class AgentProxy TODO: add description + */ +class OXYGEN_API AgentProxy: public zeitgeist::Node +{ +private: + typedef boost::array<char, 32 * 1024> TRawBuffer; + +public: + AgentProxy(int cycleMillisecs = 0); + virtual ~AgentProxy(); + + /** starts the proxy for a single agent */ + void Start(boost::shared_ptr<rcss::net::Socket> agentSocket, + rcss::net::Addr serverAddress); + + /** does the agent connection terminated so not */ + bool IsFinished() { return mFinished; } + + /** stops the current running proxy (if running!) */ + void Stop(); + +private: + /** manages server connection */ + void ServerConnectionHandler(); + + /** manages agent connection */ + void AgentConnectionHandler(); + +private: + const int mCycleMillisecs; + + /** shows if the proxy execution is finished */ + bool mFinished; + boost::shared_ptr<NetMessage> mNetMessage; + boost::shared_ptr<rcss::net::Socket> mServerSocket; + boost::shared_ptr<rcss::net::Socket> mAgentSocket; + boost::shared_ptr<NetBuffer> mAgentBuffer; + boost::thread mServerConnectionThread; + boost::thread mAgentConnectionThread; + boost::mutex mAgentBufferMutex; +}; + +DECLARE_CLASS(AgentProxy); + +} // namespace oxygen + +#endif // OXYGEN_AGENTPROXY_H Property changes on: trunk/spark/lib/oxygen/proxyserver/agentproxy.h ___________________________________________________________________ Added: svn:mime-type + text/plain Added: svn:keywords + Id Added: trunk/spark/lib/oxygen/proxyserver/agentproxy_c.cpp =================================================================== --- trunk/spark/lib/oxygen/proxyserver/agentproxy_c.cpp (rev 0) +++ trunk/spark/lib/oxygen/proxyserver/agentproxy_c.cpp 2010-01-01 22:01:05 UTC (rev 132) @@ -0,0 +1,30 @@ +/* -*- mode: c++; c-basic-offset: 4; indent-tabs-mode: nil -*- + + this file is part of rcssserver3D + Thu Dec 31 2009 + Copyright (C) 2002,2003 Koblenz University + Copyright (C) 2004-2009 RoboCup Soccer Server 3D Maintenance Group + $Id$ + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; version 2 of the License. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +*/ +#include "agentproxy.h" + +using namespace oxygen; +using namespace std; + +void CLASS(AgentProxy)::DefineClass() +{ + DEFINE_BASECLASS(zeitgeist/Node); +} Property changes on: trunk/spark/lib/oxygen/proxyserver/agentproxy_c.cpp ___________________________________________________________________ Added: svn:mime-type + text/plain Added: svn:keywords + Id Added: trunk/spark/lib/oxygen/proxyserver/proxyserver.cpp =================================================================== --- trunk/spark/lib/oxygen/proxyserver/proxyserver.cpp (rev 0) +++ trunk/spark/lib/oxygen/proxyserver/proxyserver.cpp 2010-01-01 22:01:05 UTC (rev 132) @@ -0,0 +1,146 @@ +/* -*- mode: c++; c-basic-offset: 4; indent-tabs-mode: nil -*- + + this file is part of rcssserver3D + Thu Dec 31 2009 + Copyright (C) 2002,2003 Koblenz University + Copyright (C) 2004-2009 RoboCup Soccer Server 3D Maintenance Group + $Id$ + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; version 2 of the License. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +*/ +#include "proxyserver.h" +#include <zeitgeist/logserver/logserver.h> +#include <oxygen/simulationserver/netcontrol.h> +#include <rcssnet/exception.hpp> +#include "agentproxy.h" + +using namespace oxygen; +using namespace zeitgeist; +using namespace std; +using namespace rcss::net; + +ProxyServer::ProxyServer() : Leaf(), + mRunning(false), + mCycleMillisecs(0), + mLocalAddr(0, Addr::ANY), + mServerAddr(0, Addr::ANY), + mSocket(NetControl::CreateSocket(NetControl::ST_TCP)) +{ +} + +ProxyServer::~ProxyServer() +{ +} + +void ProxyServer::SetProxyPort(Addr::PortType port) +{ + mLocalAddr.setPort(port); +} + +Addr::PortType ProxyServer::GetProxyPort() const +{ + return mLocalAddr.getPort(); +} + +void ProxyServer::SetServerAddress(const rcss::net::Addr &serverAddress) +{ + mServerAddr = serverAddress; +} + +void ProxyServer::SetCycleLength(int millisecs) +{ + mCycleMillisecs = millisecs; +} + +bool ProxyServer::Run() +{ + bool success = false; + + if (mLocalAddr.getPort() == 0) + { + GetLog()->Error() + << "(ProxyServer) ERROR: local port has no been set in '" + << GetClass()->GetName() << "'\n"; + return false; + } + if (mServerAddr.getPort() == 0) + { + GetLog()->Error() + << "(ProxyServer) ERROR: server address has no been set in '" + << GetClass()->GetName() << "'\n"; + return false; + } + if (!mSocket) + { + GetLog()->Error() + << "(ProxyServer) ERROR: No valid socket has been created.\n"; + return false; + } + if (mCycleMillisecs == 0) + { + GetLog()->Error() + << "(ProxyServer) ERROR: Cycle length not set.\n"; + return false; + } + + int ret = mSocket->setReuseAddr(true); + if (ret < 0) + { + GetLog()->Warning() + << "(ProxyServer) failed to enable reuse of server socket " + << "with '" << strerror(errno) << "'\n"; + } + + try + { + mSocket->bind(mLocalAddr); + mSocket->listen(50); + mRunning = true; + + do + { + Addr addr; + boost::shared_ptr<Socket> socket(mSocket->accept(addr)); + if (socket) + { + GetLog()->Normal() << "(ProxyServer) accepted a new connection" + << " from " << socket->getPeer() << '\n'; + + AgentProxy *agentProxy = new AgentProxy(mCycleMillisecs); + agentProxy->Start(socket, mServerAddr); + mClientProxyList.push_back(agentProxy); + } + } while (mRunning); + success = true; + } + catch (BindErr error) + { + GetLog()->Error() << "(ProxyServer) failed to bind socket with '" + << error.what() << "'" << endl; + } + catch (ListenErr error) + { + GetLog()->Error() << "(ProxyServer) failed to listen on socket with '" + << error.what() << "'" << endl; + } + catch (AcceptErr error) + { + GetLog()->Error() << "(ProxyServer) '" << GetName() + << "' failed to accept TCP connection with '" << error.what() + << endl; + } + + mSocket->close(); + return success; +} Property changes on: trunk/spark/lib/oxygen/proxyserver/proxyserver.cpp ___________________________________________________________________ Added: svn:mime-type + text/plain Added: svn:keywords + Id Added: trunk/spark/lib/oxygen/proxyserver/proxyserver.h =================================================================== --- trunk/spark/lib/oxygen/proxyserver/proxyserver.h (rev 0) +++ trunk/spark/lib/oxygen/proxyserver/proxyserver.h 2010-01-01 22:01:05 UTC (rev 132) @@ -0,0 +1,81 @@ +/* -*- mode: c++; c-basic-offset: 4; indent-tabs-mode: nil -*- + + this file is part of rcssserver3D + Thu Dec 31 2009 + Copyright (C) 2002,2003 Koblenz University + Copyright (C) 2004-2009 RoboCup Soccer Server 3D Maintenance Group + $Id$ + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; version 2 of the License. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +*/ +#ifndef OXYGEN_PROXYSERVER_H +#define OXYGEN_PROXYSERVER_H + +#include <boost/ptr_container/ptr_list.hpp> +#include <oxygen/oxygen_defines.h> +#include <zeitgeist/class.h> +#include <zeitgeist/leaf.h> +#include <rcssnet/addr.hpp> +#include <rcssnet/socket.hpp> + +namespace oxygen +{ + +class AgentProxy; + +/** \class ProxyServer TODO: Add description + */ +class OXYGEN_API ProxyServer: public zeitgeist::Leaf +{ +public: + ProxyServer(); + virtual ~ProxyServer(); + + /** sets the local port, on which connections are accepted */ + void SetProxyPort(rcss::net::Addr::PortType port); + + /** returns the local port, on which connections are accepted */ + rcss::net::Addr::PortType GetProxyPort() const; + + /** sets the server address to connect to */ + void SetServerAddress(const rcss::net::Addr &serverAddress); + + /** sets the length of a cycle in milli seconds */ + void SetCycleLength(int millisecs); + + /** starts the run loop of the proxy server, wait for incomming connection + * requests */ + bool Run(); + +private: + bool mRunning; + int mCycleMillisecs; + + /** the local port, on which connections are accepted */ + rcss::net::Addr mLocalAddr; + + /** the server address to which we should connect */ + rcss::net::Addr mServerAddr; + + /** the socket used to accept connections */ + boost::shared_ptr<rcss::net::Socket> mSocket; + + boost::ptr_list<AgentProxy> mClientProxyList; +}; + +DECLARE_CLASS(ProxyServer); + +} // namespace oxygen + +#endif // OXYGEN_PROXYSERVER_H Property changes on: trunk/spark/lib/oxygen/proxyserver/proxyserver.h ___________________________________________________________________ Added: svn:mime-type + text/plain Added: svn:keywords + Id Added: trunk/spark/lib/oxygen/proxyserver/proxyserver_c.cpp =================================================================== --- trunk/spark/lib/oxygen/proxyserver/proxyserver_c.cpp (rev 0) +++ trunk/spark/lib/oxygen/proxyserver/proxyserver_c.cpp 2010-01-01 22:01:05 UTC (rev 132) @@ -0,0 +1,47 @@ +/* -*- mode: c++; c-basic-offset: 4; indent-tabs-mode: nil -*- + + this file is part of rcssserver3D + Thu Dec 31 2009 + Copyright (C) 2002,2003 Koblenz University + Copyright (C) 2004-2009 RoboCup Soccer Server 3D Maintenance Group + $Id$ + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; version 2 of the License. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +*/ +#include "proxyserver.h" + +using namespace oxygen; +using namespace std; + +FUNCTION(ProxyServer, setCycleLength) +{ + unsigned int inMillisecs; + + if ( + (in.GetSize() != 1) || + (! in.GetValue(in.begin(), inMillisecs)) + ) + { + return false; + } + + obj->SetCycleLength(inMillisecs); + return true; +} + +void CLASS(ProxyServer)::DefineClass() +{ + DEFINE_BASECLASS(zeitgeist/Leaf); + DEFINE_FUNCTION(setCycleLength); +} Property changes on: trunk/spark/lib/oxygen/proxyserver/proxyserver_c.cpp ___________________________________________________________________ Added: svn:mime-type + text/plain Added: svn:keywords + Id Modified: trunk/spark/lib/oxygen/simulationserver/netmessage.cpp =================================================================== --- trunk/spark/lib/oxygen/simulationserver/netmessage.cpp 2009-12-29 19:52:44 UTC (rev 131) +++ trunk/spark/lib/oxygen/simulationserver/netmessage.cpp 2010-01-01 22:01:05 UTC (rev 132) @@ -19,6 +19,7 @@ */ #include "netmessage.h" #include "netbuffer.h" +#include <boost/cstdint.hpp> #include <rcssnet/socket.hpp> #ifndef WIN32 @@ -44,8 +45,8 @@ void NetMessage::PrepareToSend(std::string& msg) { // prefix the message with it's payload length - unsigned int len = htonl(static_cast<u_long>(msg.size())); - string prefix((const char*)&len,sizeof(unsigned int)); + boost::uint32_t len = htonl(static_cast<u_long>(msg.size())); + string prefix((const char*) &len, sizeof(len)); msg = prefix + msg; } @@ -57,7 +58,7 @@ } // a message is prefixed with it's payload length - const unsigned int preSz = sizeof(unsigned int); + const unsigned int preSz = sizeof(boost::uint32_t); string& data = buffer->GetData(); @@ -66,7 +67,8 @@ return false; } - unsigned int msgLen = ntohl((*(unsigned int*)data.data())); + unsigned int msgLen = + ntohl((*reinterpret_cast<const boost::uint32_t*>(data.data()))); if (data.size() < (msgLen + preSz)) { Modified: trunk/spark/lib/oxygen/simulationserver/simcontrolnode.h =================================================================== --- trunk/spark/lib/oxygen/simulationserver/simcontrolnode.h 2009-12-29 19:52:44 UTC (rev 131) +++ trunk/spark/lib/oxygen/simulationserver/simcontrolnode.h 2010-01-01 22:01:05 UTC (rev 132) @@ -84,8 +84,6 @@ float mTime; float mStep; - - boost::condition mCond; }; DECLARE_CLASS(SimControlNode); Modified: trunk/spark/lib/zeitgeist/fileserver/fileserver.cpp =================================================================== --- trunk/spark/lib/zeitgeist/fileserver/fileserver.cpp 2009-12-29 19:52:44 UTC (rev 131) +++ trunk/spark/lib/zeitgeist/fileserver/fileserver.cpp 2010-01-01 22:01:05 UTC (rev 132) @@ -31,7 +31,6 @@ FileServer::FileServer() : Node(), mNextHandle(1) { - mResourceLocations.push_back(salt::RFile::BundlePath()); } FileServer::~FileServer() Modified: trunk/spark/lib/zeitgeist/zeitgeist.cpp =================================================================== --- trunk/spark/lib/zeitgeist/zeitgeist.cpp 2009-12-29 19:52:44 UTC (rev 131) +++ trunk/spark/lib/zeitgeist/zeitgeist.cpp 2010-01-01 22:01:05 UTC (rev 132) @@ -21,6 +21,8 @@ #include "zeitgeist.h" #include <iostream> #include <sstream> +#include <salt/fileclasses.h> +#include "fileserver/fileserver.h" using namespace std; using namespace zeitgeist; @@ -73,6 +75,7 @@ // setup the dot directory in the script server mCore->GetScriptServer()->SetDotName(dotName); mCore->GetScriptServer()->SetupDotDir(); + mCore->GetFileServer()->AddResourceLocation(salt::RFile::BundlePath()); // run the zeitgeist init script mCore->GetScriptServer()->RunInitScript This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <he...@us...> - 2010-01-16 23:52:27
|
Revision: 145 http://simspark.svn.sourceforge.net/simspark/?rev=145&view=rev Author: hedayat Date: 2010-01-16 23:52:20 +0000 (Sat, 16 Jan 2010) Log Message: ----------- A temporary workaround to allow agentproxy to be compiled on Windows Added third party libraries including ruby to the Windows installer Modified Paths: -------------- trunk/spark/CMakeLists.txt trunk/spark/ChangeLog trunk/spark/lib/oxygen/proxyserver/agentproxy.cpp Modified: trunk/spark/CMakeLists.txt =================================================================== --- trunk/spark/CMakeLists.txt 2010-01-16 23:45:06 UTC (rev 144) +++ trunk/spark/CMakeLists.txt 2010-01-16 23:52:20 UTC (rev 145) @@ -190,6 +190,35 @@ install(FILES ${CMAKE_CURRENT_BINARY_DIR}/sparkconfig.h DESTINATION ${INCLUDEDIR}/${CMAKE_PROJECT_NAME}) +if (WIN32) # try to find and install third-party .dlls to lib/thirdparty directory + set(THLIBDIR ${LIBDIR}/thirdparty) + + string(REGEX REPLACE "(.*)\\.lib" "\\1.dll" ODEDLL "${ODE_LIBRARY}") + if (EXISTS ${ODEDLL}) + install(PROGRAMS ${ODEDLL} DESTINATION ${THLIBDIR}) + endif (EXISTS ${ODEDLL}) + + install(DIRECTORY "${Boost_LIBRARY_DIRS}/" DESTINATION ${THLIBDIR} + FILES_MATCHING PATTERN "*.dll") + + string(REGEX REPLACE "(.*)\\.lib" "\\1.dll" DevIL_DLL "${DevIL_LIBRARY_IL}") + if (EXISTS ${DevIL_DLL}) + install(PROGRAMS ${DevIL_DLL} DESTINATION ${THLIBDIR}) + endif (EXISTS ${DevIL_DLL}) + + string(REGEX REPLACE "(.*)/ruby.exe" "\\1/" RUBY_BINDIR "${RUBY_EXECUTABLE}") + install(DIRECTORY "${RUBY_BINDIR}" + DESTINATION ${THLIBDIR} FILES_MATCHING PATTERN "*.dll") + + install(DIRECTORY "${FREETYPE_INCLUDE_DIR_ft2build}/../bin/" + DESTINATION ${THLIBDIR} FILES_MATCHING PATTERN "*.dll") + + set(SDL_DLL "${SDL_INCLUDE_DIR}/../lib/sdl.dll") + if (EXISTS ${SDL_DLL}) + install(PROGRAMS ${SDL_DLL} DESTINATION ${THLIBDIR}) + endif (EXISTS ${SDL_DLL}) +endif (WIN32) + ########### uninstall support ############ CONFIGURE_FILE( "${CMAKE_CURRENT_SOURCE_DIR}/cmake_uninstall.cmake.in" Modified: trunk/spark/ChangeLog =================================================================== --- trunk/spark/ChangeLog 2010-01-16 23:45:06 UTC (rev 144) +++ trunk/spark/ChangeLog 2010-01-16 23:52:20 UTC (rev 145) @@ -1,3 +1,13 @@ +2010-01-17 Hedayat Vatankhah <he...@gr...> + + * lib/oxygen/proxyserver/agentproxy.cpp: + - added a temporary workaround to allow compilation under windows + + * CMakeLists.txt: + - add required third party .dlls on windows to simspark rather than + rcssserver3d, which will be installed in lib/thirdparty directory. + ruby dlls will be included too. + 2010-01-01 Hedayat Vatankhah <he...@gr...> * lib/oxygen/proxyserver/proxyserver.h: Modified: trunk/spark/lib/oxygen/proxyserver/agentproxy.cpp =================================================================== --- trunk/spark/lib/oxygen/proxyserver/agentproxy.cpp 2010-01-16 23:45:06 UTC (rev 144) +++ trunk/spark/lib/oxygen/proxyserver/agentproxy.cpp 2010-01-16 23:52:20 UTC (rev 145) @@ -28,6 +28,12 @@ #include <sys/socket.h> #endif +#ifndef EAGAIN +// FIXME: This is only a workaround, and doesn't work fine. +#define EAGAIN 0 +#define MSG_DONTWAIT 0 +#endif + using namespace oxygen; using namespace zeitgeist; using namespace std; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <he...@us...> - 2010-01-17 10:43:41
|
Revision: 147 http://simspark.svn.sourceforge.net/simspark/?rev=147&view=rev Author: hedayat Date: 2010-01-17 10:43:35 +0000 (Sun, 17 Jan 2010) Log Message: ----------- Bumped Kerosin's major version because of Sander's rendering fixes Modified Paths: -------------- trunk/spark/CMakeLists.txt trunk/spark/ChangeLog Modified: trunk/spark/CMakeLists.txt =================================================================== --- trunk/spark/CMakeLists.txt 2010-01-17 09:30:24 UTC (rev 146) +++ trunk/spark/CMakeLists.txt 2010-01-17 10:43:35 UTC (rev 147) @@ -147,7 +147,7 @@ set(OXYGEN_SO_VERSION 3) set(OXYGEN_VERSION ${OXYGEN_SO_VERSION}.3.0) set(KEROSIN_SO_VERSION 1) -set(KEROSIN_VERSION ${KEROSIN_SO_VERSION}.0.2) +set(KEROSIN_VERSION ${KEROSIN_SO_VERSION}.1.0) set(SPARK_SO_VERSION 0) set(SPARK_VERSION ${SPARK_SO_VERSION}.0.0) set(RCSSNET_SO_VERSION 0) Modified: trunk/spark/ChangeLog =================================================================== --- trunk/spark/ChangeLog 2010-01-17 09:30:24 UTC (rev 146) +++ trunk/spark/ChangeLog 2010-01-17 10:43:35 UTC (rev 147) @@ -11,7 +11,7 @@ - add required third party .dlls on windows to simspark rather than rcssserver3d, which will be installed in lib/thirdparty directory. ruby dlls will be included too. - - bumped library major versions: zeitgeist, oxygen and rcssnet + - bumped library major versions: zeitgeist, oxygen, kerosin and rcssnet - bumped package version to 0.2 2010-01-01 Hedayat Vatankhah <he...@gr...> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <a-...@us...> - 2010-02-26 09:19:52
|
Revision: 178 http://simspark.svn.sourceforge.net/simspark/?rev=178&view=rev Author: a-held Date: 2010-02-26 09:19:45 +0000 (Fri, 26 Feb 2010) Log Message: ----------- Remove a tiny bit of ODE-specific code that I overlooked Modified Paths: -------------- trunk/spark/lib/oxygen/CMakeLists.txt trunk/spark/lib/oxygen/physicsserver/int/rigidbodyint.h trunk/spark/lib/oxygen/physicsserver/rigidbody.cpp trunk/spark/lib/oxygen/physicsserver/rigidbody.h trunk/spark/lib/oxygen/physicsserver/rigidbody_c.cpp trunk/spark/plugin/odeimps/oderigidbody.cpp trunk/spark/plugin/odeimps/oderigidbody.h Removed Paths: ------------- trunk/spark/lib/oxygen/physicsserver/odeobject.cpp trunk/spark/lib/oxygen/physicsserver/odeobject.h trunk/spark/lib/oxygen/physicsserver/odeobject_c.cpp trunk/spark/lib/oxygen/physicsserver/odewrapper.h Modified: trunk/spark/lib/oxygen/CMakeLists.txt =================================================================== --- trunk/spark/lib/oxygen/CMakeLists.txt 2010-02-25 12:27:30 UTC (rev 177) +++ trunk/spark/lib/oxygen/CMakeLists.txt 2010-02-26 09:19:45 UTC (rev 178) @@ -89,8 +89,8 @@ physicsserver/int/universaljointint.h physicsserver/int/worldint.h - proxyserver/agentproxy.h - proxyserver/proxyserver.h + #proxyserver/agentproxy.h + #proxyserver/proxyserver.h sceneserver/sceneimporter.h sceneserver/basenode.h sceneserver/fpscontroller.h @@ -279,10 +279,10 @@ monitorserver/custommonitor_c.cpp monitorserver/monitorcmdparser.cpp monitorserver/monitorcmdparser_c.cpp - proxyserver/agentproxy.cpp - proxyserver/agentproxy_c.cpp - proxyserver/proxyserver.cpp - proxyserver/proxyserver_c.cpp + #proxyserver/agentproxy.cpp + #proxyserver/agentproxy_c.cpp + #proxyserver/proxyserver.cpp + #proxyserver/proxyserver_c.cpp ) if(SPADES_FOUND) set(oxygen_LIB_SRCS Modified: trunk/spark/lib/oxygen/physicsserver/int/rigidbodyint.h =================================================================== --- trunk/spark/lib/oxygen/physicsserver/int/rigidbodyint.h 2010-02-25 12:27:30 UTC (rev 177) +++ trunk/spark/lib/oxygen/physicsserver/int/rigidbodyint.h 2010-02-26 09:19:45 UTC (rev 178) @@ -247,6 +247,17 @@ by \param worldID */ virtual long CreateBody(long worldID) = 0; + + /** Creates a new mass object with the information passed on to this + method via \param mass and \param cVector + */ + virtual GenericMass& CreateMass(float mass, salt::Vector3f cVector) = 0; + + /** Sets the value of the inertia tensor of this body. \param i is the + index of the \param value 's position in the inertia tensor. + (It's a 3x3 matrix) + */ + virtual void SetInertiaTensorAt(int i, float value, GenericMass& mass) = 0; }; } //namespace oxygen Deleted: trunk/spark/lib/oxygen/physicsserver/odeobject.cpp =================================================================== --- trunk/spark/lib/oxygen/physicsserver/odeobject.cpp 2010-02-25 12:27:30 UTC (rev 177) +++ trunk/spark/lib/oxygen/physicsserver/odeobject.cpp 2010-02-26 09:19:45 UTC (rev 178) @@ -1,167 +0,0 @@ -/* -*- mode: c++; c-basic-offset: 4; indent-tabs-mode: nil -*- - - this file is part of rcssserver3D - Fri May 9 2003 - Copyright (C) 2002,2003 Koblenz University - Copyright (C) 2003 RoboCup Soccer Server 3D Maintenance Group - $Id$ - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; version 2 of the License. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -*/ -#include "odeobject.h" -#include "space.h" -#include "world.h" -#include <oxygen/sceneserver/scene.h> -#include <zeitgeist/logserver/logserver.h> - -using namespace oxygen; -using namespace boost; - -ODEObject::ODEObject() : BaseNode() -{ -} - -ODEObject::~ODEObject() -{ -} - -void ODEObject::OnUnlink() -{ - DestroyODEObject(); -} - -/** returns the world node */ -shared_ptr<World> ODEObject::GetWorld() const -{ - shared_ptr<Scene> scene = GetScene(); - if (scene.get() == 0) - { - GetLog()->Error() << "(ODEObject) ERROR: found no Scene node\n"; - return shared_ptr<World>(); - } - - shared_ptr<World> worldNode = shared_dynamic_cast<World> - (scene->GetChildOfClass("World")); - if (worldNode.get() == 0) - { - GetLog()->Error() << "(ODEObject) ERROR: found no World node\n"; - } - - return worldNode; -} - -shared_ptr<Space> ODEObject::GetSpace() -{ - // try to find the nearest parent space object - weak_ptr<Space> parentSpace = FindParentSupportingClass<Space>(); - if (! parentSpace.expired()) - { - return parentSpace.lock(); - } - - // return the global space instance - shared_ptr<Scene> scene = GetScene(); - if (scene.get() == 0) - { - GetLog()->Error() << "(ODEObject) ERROR: found no Scene node\n"; - return shared_ptr<Space>(); - } - - shared_ptr<Space> spaceNode = shared_dynamic_cast<Space> - (scene->GetChildOfClass("Space")); - if (spaceNode.get() == 0) - { - GetLog()->Error() << "(ODEObject) ERROR: found no Space node\n"; - } - - return spaceNode; -} - -dWorldID ODEObject::GetWorldID() -{ - shared_ptr<World> world = GetWorld(); - if (world.get() == 0) - { - return 0; - } - - dWorldID worldId = world->GetODEWorld(); - if (worldId == 0) - { - GetLog()->Error() - << "(ODEObject) ERROR: World returned empty ODE handle\n"; - } - - return worldId; -} - -dSpaceID ODEObject::FindSpaceID() -{ - shared_ptr<Space> space = GetSpace(); - if (space.get() == 0) - { - return 0; - } - - dSpaceID spaceId = space->GetODESpace(); - - if (spaceId == 0) - { - GetLog()->Error() - << "(ODEObject) ERROR: Space returned empty ODE handle\n"; - } - - return spaceId; -} - -dSpaceID ODEObject::GetParentSpaceID() -{ - return 0; -} - -void ODEObject::ConvertRotationMatrix(const salt::Matrix& rot, dMatrix3& matrix) -{ - matrix[0] = rot.m[0]; - matrix[1] = rot.m[4]; - matrix[2] = rot.m[8]; - matrix[3] = 0; - matrix[4] = rot.m[1]; - matrix[5] = rot.m[5]; - matrix[6] = rot.m[9]; - matrix[7] = 0; - matrix[8] = rot.m[2]; - matrix[9] = rot.m[6]; - matrix[10] = rot.m[10]; - matrix[11] = 0; -} - -void ODEObject::ConvertRotationMatrix(const dReal* matrix, salt::Matrix& rot) const -{ - rot.m[0] = matrix[0] ; - rot.m[4] = matrix[1] ; - rot.m[8] = matrix[2]; - rot.m[12] = matrix[3]; - rot.m[1] = matrix[4]; - rot.m[5] = matrix[5]; - rot.m[9] = matrix[6]; - rot.m[13] = matrix[7]; - rot.m[2] = matrix[8]; - rot.m[6] = matrix[9]; - rot.m[10] = matrix[10] ; - rot.m[14] = matrix[11]; - rot.m[3] = 0.0; - rot.m[7] = 0.0; - rot.m[11] = 0.0; - rot.m[15] = 1.0; -} Deleted: trunk/spark/lib/oxygen/physicsserver/odeobject.h =================================================================== --- trunk/spark/lib/oxygen/physicsserver/odeobject.h 2010-02-25 12:27:30 UTC (rev 177) +++ trunk/spark/lib/oxygen/physicsserver/odeobject.h 2010-02-26 09:19:45 UTC (rev 178) @@ -1,83 +0,0 @@ -/* -*- mode: c++; c-basic-offset: 4; indent-tabs-mode: nil -*- - - this file is part of rcssserver3D - Fri May 9 2003 - Copyright (C) 2002,2003 Koblenz University - Copyright (C) 2003 RoboCup Soccer Server 3D Maintenance Group - $Id$ - $Id$ - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; version 2 of the License. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -*/ -#ifndef OXYGEN_ODEOBJECT_H -#define OXYGEN_ODEOBJECT_H - -#include <oxygen/oxygen_defines.h> -#include <oxygen/sceneserver/basenode.h> -#include "odewrapper.h" - -namespace oxygen -{ -class Space; -class World; - -/** ODEObject is the base of all classes encapsulating ODE concepts - */ -class OXYGEN_API ODEObject : public BaseNode -{ -public: - // - // Functions - // - ODEObject(); - virtual ~ODEObject(); - - /** This rountine is called, before the hierarchy object is - removed from the parent. It can be overridden to support - custom 'unlink' behavior. - */ - virtual void OnUnlink(); - - /** returns the ODE world handle */ - dWorldID GetWorldID(); - - /** returns the nearest parent space ODE handle */ - dSpaceID FindSpaceID(); - - /** returns the ODE handle ID of the containing parent space */ - virtual dSpaceID GetParentSpaceID(); - - /** destroy the managed ODE object */ - virtual void DestroyODEObject() = 0; - - /** returns the world node */ - boost::shared_ptr<World> GetWorld() const; - -protected: - /** finds the nearest parent space node */ - boost::shared_ptr<Space> GetSpace(); - - /** converts the rotation part of a salt::Matrix to an ODE - dMatrix3 */ - void ConvertRotationMatrix(const salt::Matrix& rot, dMatrix3& matrix); - - /** coverts the ODE dMatrix3 to the rotation part of a salt::Matrix */ - void ConvertRotationMatrix(const dReal* matrix, salt::Matrix& rot) const; -}; - -DECLARE_ABSTRACTCLASS(ODEObject); - -} //namespace oxygen - -#endif //OXYGEN_ODEOBJECT_H Deleted: trunk/spark/lib/oxygen/physicsserver/odeobject_c.cpp =================================================================== --- trunk/spark/lib/oxygen/physicsserver/odeobject_c.cpp 2010-02-25 12:27:30 UTC (rev 177) +++ trunk/spark/lib/oxygen/physicsserver/odeobject_c.cpp 2010-02-26 09:19:45 UTC (rev 178) @@ -1,29 +0,0 @@ -/* -*- mode: c++ -*- - - this file is part of rcssserver3D - Fri May 9 2003 - Copyright (C) 2003 Koblenz University - $Id$ - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; version 2 of the License. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -*/ - -#include "odeobject.h" - -using namespace oxygen; - -void CLASS(ODEObject)::DefineClass() -{ - DEFINE_BASECLASS(oxygen/BaseNode); -} Deleted: trunk/spark/lib/oxygen/physicsserver/odewrapper.h =================================================================== --- trunk/spark/lib/oxygen/physicsserver/odewrapper.h 2010-02-25 12:27:30 UTC (rev 177) +++ trunk/spark/lib/oxygen/physicsserver/odewrapper.h 2010-02-26 09:19:45 UTC (rev 178) @@ -1,80 +0,0 @@ -/* -*- mode: c++; c-basic-offset: 4; indent-tabs-mode: nil -*- - - this file is part of rcssserver3D - Fri May 9 2003 - Copyright (C) 2002,2003 Koblenz University - Copyright (C) 2003 RoboCup Soccer Server 3D Maintenance Group - $Id$ - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; version 2 of the License. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -*/ -#ifndef OXYGEN_ODEWRAPPER_H -#define OXYGEN_ODEWRAPPER_H - -#undef EXTERN -#undef HAVE_VPRINTF -#undef PACKAGE -#undef PACKAGE_BUGREPORT -#undef PACKAGE_NAME -#undef PACKAGE_STRING -#undef PACKAGE_TARNAME -#undef PACKAGE_VERSION -#undef PREFIX -#undef VERSION - -#ifdef WIN32 - -#ifdef copysignf -#undef copysignf -#endif - -#ifdef copysign -#undef copysign -#endif - -#endif // WIN32 - -#ifdef __APPLE__ - -// there is a conflicting type in a system header (Leopard) -// so we define a dummy here -#define uint32 dummy - -#endif - -#include <ode/ode.h> - -#ifdef __APPLE__ - -// undefine the dummy -#undef uint32 - -#endif - -#undef EXTERN -#undef HAVE_VPRINTF -#undef PACKAGE -#undef PACKAGE_BUGREPORT -#undef PACKAGE_NAME -#undef PACKAGE_STRING -#undef PACKAGE_TARNAME -#undef PACKAGE_VERSION -#undef PREFIX -#undef VERSION - -#ifdef HAVE_CONFIG_H -#include <sparkconfig.h> -#endif - -#endif // OXYGEN_ODEWRAPPER Modified: trunk/spark/lib/oxygen/physicsserver/rigidbody.cpp =================================================================== --- trunk/spark/lib/oxygen/physicsserver/rigidbody.cpp 2010-02-25 12:27:30 UTC (rev 177) +++ trunk/spark/lib/oxygen/physicsserver/rigidbody.cpp 2010-02-26 09:19:45 UTC (rev 178) @@ -389,3 +389,13 @@ { mRigidBodyImp->TranslateMass(v, mBodyID); } + +GenericMass& RigidBody::CreateMass(float mass, salt::Vector3f cVector) +{ + mRigidBodyImp->CreateMass(mass, cVector); +} + +void RigidBody::SetInertiaTensorAt(int i, float value, GenericMass& mass) +{ + mRigidBodyImp->SetInertiaTensorAt(i, value, mass); +} Modified: trunk/spark/lib/oxygen/physicsserver/rigidbody.h =================================================================== --- trunk/spark/lib/oxygen/physicsserver/rigidbody.h 2010-02-25 12:27:30 UTC (rev 177) +++ trunk/spark/lib/oxygen/physicsserver/rigidbody.h 2010-02-26 09:19:45 UTC (rev 178) @@ -239,6 +239,17 @@ orientation */ void SynchronizeParent() const; + + /** Creates a new mass object with the information passed on to this + method via \param mass and \param cVector + */ + GenericMass& CreateMass(float mass, salt::Vector3f cVector); + + /** Sets the value of the inertia tensor of this body. \param i is the + index of the \param value 's position in the inertia tensor. + (It's a 3x3 matrix) + */ + void SetInertiaTensorAt(int i, float value, GenericMass& mass); protected: /** creates the managed body and moves it to the position of Modified: trunk/spark/lib/oxygen/physicsserver/rigidbody_c.cpp =================================================================== --- trunk/spark/lib/oxygen/physicsserver/rigidbody_c.cpp 2010-02-25 12:27:30 UTC (rev 177) +++ trunk/spark/lib/oxygen/physicsserver/rigidbody_c.cpp 2010-02-26 09:19:45 UTC (rev 178) @@ -20,8 +20,6 @@ */ #include <oxygen/physicsserver/rigidbody.h> -//TODO: Do not include odewrapper in this file! -#include <../plugin/odeimps/odewrapper.h> using namespace boost; using namespace oxygen; @@ -88,22 +86,33 @@ return false; } - dMass mass; - mass.mass = inMass; - mass.c[0] = inCenter[0]; - mass.c[1] = inCenter[1]; - mass.c[2] = inCenter[2]; - + GenericMass& mass = obj->CreateMass(inMass, inCenter); + //mass.mass = inMass; + //mass.c[0] = inCenter[0]; + //mass.c[1] = inCenter[1]; + //mass.c[2] = inCenter[2]; + + float currentValue; + + //try to emulate the loop commented out below without understanding it for (int i=0;i<9;++i) { - if (! in.AdvanceValue(iter,mass.I[i])) + if (in.AdvanceValue(iter,currentValue)) { - return false; + obj->SetInertiaTensorAt(i, currentValue, mass); } - } + else return false; + } + + //for (int i=0;i<9;++i) + // { + // if (! in.AdvanceValue(iter,mass.I[i])) + // { + // return false; + // } + // } - GenericMass& massRef = (GenericMass&) mass; - obj->SetMassParameters(massRef); + obj->SetMassParameters(mass); return true; } Modified: trunk/spark/plugin/odeimps/oderigidbody.cpp =================================================================== --- trunk/spark/plugin/odeimps/oderigidbody.cpp 2010-02-25 12:27:30 UTC (rev 177) +++ trunk/spark/plugin/odeimps/oderigidbody.cpp 2010-02-26 09:19:45 UTC (rev 178) @@ -455,3 +455,21 @@ dBodyGetMass(ODEBody, &m); dMassTranslate(&m,v[0],v[1],v[2]); } + +GenericMass& RigidBodyImp::CreateMass(float mass, salt::Vector3f cVector) +{ + dMass ODEMass; + ODEMass.mass = mass; + ODEMass.c[0] = cVector[0]; + ODEMass.c[1] = cVector[1]; + ODEMass.c[2] = cVector[2]; + + GenericMass& massRef = (GenericMass&) ODEMass; + return massRef; +} + +void RigidBodyImp::SetInertiaTensorAt(int i, float value, GenericMass& mass) +{ + dMass& ODEMass = (dMass&) mass; + ODEMass.I[i] = value; +} Modified: trunk/spark/plugin/odeimps/oderigidbody.h =================================================================== --- trunk/spark/plugin/odeimps/oderigidbody.h 2010-02-25 12:27:30 UTC (rev 177) +++ trunk/spark/plugin/odeimps/oderigidbody.h 2010-02-26 09:19:45 UTC (rev 178) @@ -90,6 +90,8 @@ void BodySetData(oxygen::RigidBody* rb, long bodyID); oxygen::RigidBody* BodyGetData(long bodyID); long CreateBody(long worldID); + oxygen::GenericMass& CreateMass(float mass, salt::Vector3f cVector); + void SetInertiaTensorAt(int i, float value, oxygen::GenericMass& mass); protected: //These methods are only called internally and are not declared in the interface. This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <mar...@us...> - 2010-02-28 01:33:50
|
Revision: 179 http://simspark.svn.sourceforge.net/simspark/?rev=179&view=rev Author: marianbuchta Date: 2010-02-28 01:33:40 +0000 (Sun, 28 Feb 2010) Log Message: ----------- - change shared_ptr -> boost::shared_ptr and weak_ptr -> boost::weak_ptr because of Visual Studio 2010 compatibility. Issue between boost::shared_ptr and std::tr1::shared_ptr - added new version of FindBoost.cmake: finding boost libraries created by Visual C++ 2010 compiler. Modified Paths: -------------- trunk/spark/ChangeLog trunk/spark/cmake/FindBoost.cmake trunk/spark/lib/kerosin/fontserver/fontserver.cpp trunk/spark/lib/kerosin/imageserver/imageserver.cpp trunk/spark/lib/kerosin/imageserver/imageserver.h trunk/spark/lib/kerosin/inputserver/inputcontrol.cpp trunk/spark/lib/kerosin/inputserver/inputserver.cpp trunk/spark/lib/kerosin/materialserver/material2dtexture.cpp trunk/spark/lib/kerosin/materialserver/materialserver.cpp trunk/spark/lib/kerosin/renderserver/renderserver.cpp trunk/spark/lib/kerosin/sceneserver/singlematnode.cpp trunk/spark/lib/kerosin/sceneserver/staticmesh.cpp trunk/spark/lib/kerosin/soundserver/soundserver.cpp trunk/spark/lib/kerosin/soundserver/soundserver_c.cpp trunk/spark/lib/kerosin/textureserver/textureserver.cpp trunk/spark/lib/oxygen/agentaspect/agentaspect.cpp trunk/spark/lib/oxygen/agentaspect/effector.cpp trunk/spark/lib/oxygen/controlaspect/controlaspect.cpp trunk/spark/lib/oxygen/gamecontrolserver/behavior.cpp trunk/spark/lib/oxygen/gamecontrolserver/gamecontrolserver.cpp trunk/spark/lib/oxygen/geometryserver/geometryserver.cpp trunk/spark/lib/oxygen/geometryserver/stdmeshimporter.cpp trunk/spark/lib/oxygen/monitorserver/monitorserver.cpp trunk/spark/lib/oxygen/monitorserver/monitorserver.h trunk/spark/lib/oxygen/physicsserver/collider.cpp trunk/spark/lib/oxygen/physicsserver/collisionhandler.cpp trunk/spark/lib/oxygen/physicsserver/contactjointhandler.cpp trunk/spark/lib/oxygen/physicsserver/joint.cpp trunk/spark/lib/oxygen/physicsserver/physicsobject.cpp trunk/spark/lib/oxygen/physicsserver/physicsserver.cpp trunk/spark/lib/oxygen/physicsserver/recorderhandler.cpp trunk/spark/lib/oxygen/physicsserver/rigidbody.cpp trunk/spark/lib/oxygen/physicsserver/sliderjoint.cpp trunk/spark/lib/oxygen/physicsserver/space.cpp trunk/spark/lib/oxygen/physicsserver/world.cpp trunk/spark/lib/oxygen/sceneserver/basenode.cpp trunk/spark/lib/oxygen/sceneserver/basenode_c.cpp trunk/spark/lib/oxygen/sceneserver/fpscontroller.cpp trunk/spark/lib/oxygen/sceneserver/sceneserver.cpp trunk/spark/lib/oxygen/sceneserver/transform.cpp trunk/spark/lib/oxygen/simulationserver/agentcontrol.cpp trunk/spark/lib/oxygen/simulationserver/monitorcontrol.cpp trunk/spark/lib/oxygen/simulationserver/monitorlogger.cpp trunk/spark/lib/oxygen/simulationserver/netclient.cpp trunk/spark/lib/oxygen/simulationserver/netcontrol.cpp trunk/spark/lib/oxygen/simulationserver/netmessage.cpp trunk/spark/lib/oxygen/simulationserver/simcontrolnode.cpp trunk/spark/lib/oxygen/simulationserver/simulationserver.cpp trunk/spark/lib/oxygen/simulationserver/traincontrol.cpp trunk/spark/lib/zeitgeist/class.cpp trunk/spark/lib/zeitgeist/class.h trunk/spark/lib/zeitgeist/core.cpp trunk/spark/lib/zeitgeist/corecontext.cpp trunk/spark/lib/zeitgeist/fileserver/fileserver.cpp trunk/spark/lib/zeitgeist/leaf.cpp trunk/spark/lib/zeitgeist/node.cpp trunk/spark/lib/zeitgeist/object.cpp trunk/spark/lib/zeitgeist/object.h trunk/spark/lib/zeitgeist/scriptserver/scriptserver.cpp trunk/spark/lib/zeitgeist/zeitgeist.cpp trunk/spark/plugin/accelerometer/accelerometer.cpp trunk/spark/plugin/agentsynceffector/agentsynceffector.cpp trunk/spark/plugin/collisionperceptor/collisionperceptor.cpp trunk/spark/plugin/collisionperceptor/perceptorhandler.cpp trunk/spark/plugin/collisionperceptor/touchperceptor.cpp trunk/spark/plugin/collisionperceptor/touchperceptorhandler.cpp trunk/spark/plugin/filesystemstd/filesystemstd.cpp trunk/spark/plugin/forceeffector/forceeffector.cpp trunk/spark/plugin/gyrorateperceptor/gyrorateperceptor.cpp trunk/spark/plugin/imageperceptor/imageperceptor.h trunk/spark/plugin/inputsdl/inputsystemsdl.cpp trunk/spark/plugin/objimporter/objimporter.cpp trunk/spark/plugin/odeimps/odejoint.cpp trunk/spark/plugin/perfectvisionperceptor/perfectvisionperceptor.cpp trunk/spark/plugin/rosimporter/rosimporter.cpp trunk/spark/plugin/rubysceneimporter/rubysceneimporter.cpp trunk/spark/plugin/sceneeffector/sceneeffector.cpp trunk/spark/plugin/sexpparser/sexpparser.cpp trunk/spark/plugin/sparkagent/hinge2effector.cpp trunk/spark/plugin/sparkagent/hingeeffector.cpp trunk/spark/plugin/sparkagent/universaljointeffector.cpp trunk/spark/plugin/sparkmonitor/sparkmonitor.cpp trunk/spark/plugin/sparkmonitor/sparkmonitorclient.cpp trunk/spark/plugin/sparkmonitor/sparkmonitorlogfileserver.cpp trunk/spark/spark/spark.cpp trunk/spark/test/coretest/main.cpp trunk/spark/test/fonttest/main.cpp trunk/spark/test/inputtest/main.cpp Modified: trunk/spark/ChangeLog =================================================================== --- trunk/spark/ChangeLog 2010-02-26 09:19:45 UTC (rev 178) +++ trunk/spark/ChangeLog 2010-02-28 01:33:40 UTC (rev 179) @@ -1,3 +1,97 @@ +2010-02-28 Marian Buchta <mar...@gm...> + + * lib/kerosin/fontserver/fontserver.cpp: + * lib/kerosin/imageserver/imageserver.cpp: + * lib/kerosin/imageserver/imageserver.h: + * lib/kerosin/inputserver/inputcontrol.cpp: + * lib/kerosin/inputserver/inputserver.cpp: + * lib/kerosin/materialserver/material2dtexture.cpp: + * lib/kerosin/materialserver/materialserver.cpp: + * lib/kerosin/renderserver/renderserver.cpp: + * lib/kerosin/sceneserver/singlematnode.cpp: + * lib/kerosin/sceneserver/staticmesh.cpp: + * lib/kerosin/soundserver/soundserver.cpp: + * lib/kerosin/soundserver/soundserver_c.cpp: + * lib/kerosin/textureserver/textureserver.cpp: + * lib/oxygen/agentaspect/agentaspect.cpp: + * lib/oxygen/agentaspect/effector.cpp: + * lib/oxygen/controlaspect/controlaspect.cpp: + * lib/oxygen/gamecontrolserver/behavior.cpp: + * lib/oxygen/gamecontrolserver/gamecontrolserver.cpp: + * lib/oxygen/geometryserver/geometryserver.cpp: + * lib/oxygen/geometryserver/stdmeshimporter.cpp: + * lib/oxygen/monitorserver/monitorserver.cpp: + * lib/oxygen/monitorserver/monitorserver.h: + * lib/oxygen/physicsserver/collider.cpp: + * lib/oxygen/physicsserver/collisionhandler.cpp: + * lib/oxygen/physicsserver/contactjointhandler.cpp: + * lib/oxygen/physicsserver/joint.cpp: + * lib/oxygen/physicsserver/physicsobject.cpp: + * lib/oxygen/physicsserver/physicsserver.cpp: + * lib/oxygen/physicsserver/recorderhandler.cpp: + * lib/oxygen/physicsserver/rigidbody.cpp: + * lib/oxygen/physicsserver/sliderjoint.cpp: + * lib/oxygen/physicsserver/space.cpp: + * lib/oxygen/physicsserver/world.cpp: + * lib/oxygen/sceneserver/basenode.cpp: + * lib/oxygen/sceneserver/basenode_c.cpp: + * lib/oxygen/sceneserver/fpscontroller.cpp: + * lib/oxygen/sceneserver/sceneserver.cpp: + * lib/oxygen/sceneserver/transform.cpp: + * lib/oxygen/simulationserver/agentcontrol.cpp: + * lib/oxygen/simulationserver/monitorcontrol.cpp: + * lib/oxygen/simulationserver/monitorlogger.cpp: + * lib/oxygen/simulationserver/netclient.cpp: + * lib/oxygen/simulationserver/netcontrol.cpp: + * lib/oxygen/simulationserver/netmessage.cpp: + * lib/oxygen/simulationserver/simcontrolnode.cpp: + * lib/oxygen/simulationserver/simulationserver.cpp: + * lib/oxygen/simulationserver/traincontrol.cpp: + * lib/zeitgeist/class.cpp: + * lib/zeitgeist/class.h: + * lib/zeitgeist/core.cpp: + * lib/zeitgeist/corecontext.cpp: + * lib/zeitgeist/fileserver/fileserver.cpp: + * lib/zeitgeist/leaf.cpp: + * lib/zeitgeist/node.cpp: + * lib/zeitgeist/object.cpp: + * lib/zeitgeist/object.h: + * lib/zeitgeist/scriptserver/scriptserver.cpp: + * lib/zeitgeist/zeitgeist.cpp: + * plugin/accelerometer/accelerometer.cpp: + * plugin/agentsynceffector/agentsynceffector.cpp: + * plugin/collisionperceptor/collisionperceptor.cpp: + * plugin/collisionperceptor/perceptorhandler.cpp: + * plugin/collisionperceptor/touchperceptor.cpp: + * plugin/collisionperceptor/touchperceptorhandler.cpp: + * plugin/filesystemstd/filesystemstd.cpp: + * plugin/forceeffector/forceeffector.cpp: + * plugin/gyrorateperceptor/gyrorateperceptor.cpp: + * plugin/imageperceptor/imageperceptor.h: + * plugin/inputsdl/inputsystemsdl.cpp: + * plugin/objimporter/objimporter.cpp: + * plugin/odeimps/odejoint.cpp: + * plugin/perfectvisionperceptor/perfectvisionperceptor.cpp: + * plugin/rosimporter/rosimporter.cpp: + * plugin/rubysceneimporter/rubysceneimporter.cpp: + * plugin/sceneeffector/sceneeffector.cpp: + * plugin/sexpparser/sexpparser.cpp: + * plugin/sparkagent/hinge2effector.cpp: + * plugin/sparkagent/hingeeffector.cpp: + * plugin/sparkagent/universaljointeffector.cpp: + * plugin/sparkmonitor/sparkmonitor.cpp: + * plugin/sparkmonitor/sparkmonitorclient.cpp: + * plugin/sparkmonitor/sparkmonitorlogfileserver.cpp: + * spark/spark.cpp: + * test/coretest/main.cpp: + * test/fonttest/main.cpp: + * test/inputtest/main.cpp: + - change shared_ptr -> boost::shared_ptr and weak_ptr -> boost::weak_ptr + because of Visual Studio 2010 compatibility. Issue between boost::shared_ptr and std::tr1::shared_ptr + + * cmake/FindBoost.cmake: + - added new version of FindBoost.cmake: finding boost libraries created by Visual C++ 2010 compiler. + 2010-01-17 Hedayat Vatankhah <he...@gr...> * NEWS: Modified: trunk/spark/cmake/FindBoost.cmake =================================================================== --- trunk/spark/cmake/FindBoost.cmake 2010-02-26 09:19:45 UTC (rev 178) +++ trunk/spark/cmake/FindBoost.cmake 2010-02-28 01:33:40 UTC (rev 179) @@ -1,860 +1,938 @@ -# - Try to find Boost include dirs and libraries -# Usage of this module as follows: -# -# == Using Header-Only libraries from within Boost: == -# -# find_package( Boost 1.36.0 ) -# if(Boost_FOUND) -# include_directories(${Boost_INCLUDE_DIRS}) -# add_executable(foo foo.cc) -# endif() -# -# -# == Using actual libraries from within Boost: == -# -# set(Boost_USE_STATIC_LIBS ON) -# set(Boost_USE_MULTITHREADED ON) -# find_package( Boost 1.36.0 COMPONENTS date_time filesystem system ... ) -# -# if(Boost_FOUND) -# include_directories(${Boost_INCLUDE_DIRS}) -# add_executable(foo foo.cc) -# target_link_libraries(foo ${Boost_LIBRARIES}) -# endif() -# -# -# The components list needs to contain actual names of boost libraries only, -# such as "date_time" for "libboost_date_time". If you're using parts of -# Boost that contain header files only (e.g. foreach) you do not need to -# specify COMPONENTS. -# -# You should provide a minimum version number that should be used. If you provide this -# version number and specify the REQUIRED attribute, this module will fail if it -# can't find the specified or a later version. If you specify a version number this is -# automatically put into the considered list of version numbers and thus doesn't need -# to be specified in the Boost_ADDITIONAL_VERSIONS variable (see below). -# -# NOTE for Visual Studio Users: -# Automatic linking is used on MSVC & Borland compilers by default when -# #including things in Boost. It's important to note that setting -# Boost_USE_STATIC_LIBS to OFF is NOT enough to get you dynamic linking, -# should you need this feature. Automatic linking typically uses static -# libraries with a few exceptions (Boost.Python is one). -# -# Please see the section below near Boost_LIB_DIAGNOSTIC_DEFINITIONS for -# more details. Adding a TARGET_LINK_LIBRARIES() as shown in the example -# above appears to cause VS to link dynamically if Boost_USE_STATIC_LIBS -# gets set to OFF. It is suggested you avoid automatic linking since it -# will make your application less portable. -# -# =========== The mess that is Boost_ADDITIONAL_VERSIONS (sorry?) ============ -# -# OK, so the Boost_ADDITIONAL_VERSIONS variable can be used to specify a list of -# boost version numbers that should be taken into account when searching -# for Boost. Unfortunately boost puts the version number into the -# actual filename for the libraries, so this variable will certainly be needed -# in the future when new Boost versions are released. -# -# Currently this module searches for the following version numbers: -# 1.33, 1.33.0, 1.33.1, 1.34, 1.34.0, 1.34.1, 1.35, 1.35.0, 1.35.1, -# 1.36, 1.36.0, 1.36.1, 1.37, 1.37.0, 1.38, 1.38.0 -# -# NOTE: If you add a new major 1.x version in Boost_ADDITIONAL_VERSIONS you should -# add both 1.x and 1.x.0 as shown above. Official Boost include directories -# omit the 3rd version number from include paths if it is 0 although not all -# binary Boost releases do so. -# -# SET(Boost_ADDITIONAL_VERSIONS "0.99" "0.99.0" "1.78" "1.78.0") -# -# ============================================================================ -# -# Variables used by this module, they can change the default behaviour and need to be set -# before calling find_package: -# -# Boost_USE_MULTITHREADED Can be set to OFF to use the non-multithreaded -# boost libraries. If not specified, defaults -# to ON. -# -# Boost_USE_STATIC_LIBS Can be set to ON to force the use of the static -# boost libraries. Defaults to OFF. -# -# Other Variables used by this module which you may want to set. -# -# Boost_ADDITIONAL_VERSIONS A list of version numbers to use for searching -# the boost include directory. Please see -# the documentation above regarding this -# annoying, but necessary variable :( -# -# Boost_DEBUG Set this to TRUE to enable debugging output -# of FindBoost.cmake if you are having problems. -# Please enable this before filing any bug -# reports. -# -# Boost_COMPILER Set this to the compiler suffix used by Boost -# (e.g. "-gcc43") if FindBoods has problems finding -# the proper Boost installation -# -# These last three variables are available also as environment variables: -# -# BOOST_ROOT or BOOSTROOT The preferred installation prefix for searching for -# Boost. Set this if the module has problems finding -# the proper Boost installation. -# -# BOOST_INCLUDEDIR Set this to the include directory of Boost, if the -# module has problems finding the proper Boost installation -# -# BOOST_LIBRARYDIR Set this to the lib directory of Boost, if the -# module has problems finding the proper Boost installation -# -# Variables defined by this module: -# -# Boost_FOUND System has Boost, this means the include dir was -# found, as well as all the libraries specified in -# the COMPONENTS list. -# -# Boost_INCLUDE_DIRS Boost include directories: not cached -# -# Boost_INCLUDE_DIR This is almost the same as above, but this one is -# cached and may be modified by advanced users -# -# Boost_LIBRARIES Link these to use the Boost libraries that you -# specified: not cached -# -# Boost_LIBRARY_DIRS The path to where the Boost library files are. -# -# Boost_VERSION The version number of the boost libraries that -# have been found, same as in version.hpp from Boost -# -# Boost_LIB_VERSION The version number in filename form as -# it's appended to the library filenames -# -# Boost_MAJOR_VERSION major version number of boost -# Boost_MINOR_VERSION minor version number of boost -# Boost_SUBMINOR_VERSION subminor version number of boost -# -# Boost_LIB_DIAGNOSTIC_DEFINITIONS [WIN32 Only] You can call -# add_definitions(${Boost_LIB_DIAGNOSTIC_DEFINTIIONS}) -# to have diagnostic information about Boost's -# automatic linking outputted during compilation time. -# -# For each component you list the following variables are set. -# ATTENTION: The component names need to be in lower case, just as the boost -# library names however the CMake variables use upper case for the component -# part. So you'd get Boost_SERIALIZATION_FOUND for example. -# -# Boost_${COMPONENT}_FOUND True IF the Boost library "component" was found. -# Boost_${COMPONENT}_LIBRARY The absolute path of the Boost library "component". -# Boost_${COMPONENT}_LIBRARY_DEBUG The absolute path of the debug version of the -# Boost library "component". -# Boost_${COMPONENT}_LIBRARY_RELEASE The absolute path of the release version of the -# Boost library "component" -# -# Copyright (c) 2006-2008 Andreas Schneider <ma...@cy...> -# Copyright (c) 2007 Wengo -# Copyright (c) 2007 Mike Jackson -# Copyright (c) 2008 Andreas Pakulat <ap...@gm...> -# -# Redistribution AND use is allowed according to the terms of the New -# BSD license. -# For details see the accompanying COPYING-CMAKE-SCRIPTS file. -# - -IF(NOT DEFINED Boost_USE_MULTITHREADED) - SET(Boost_USE_MULTITHREADED TRUE) -ENDIF() - -if(Boost_FIND_VERSION_EXACT) - # The version may appear in a directory with or without the patch - # level, even when the patch level is non-zero. - set(_boost_TEST_VERSIONS - "${Boost_FIND_VERSION_MAJOR}.${Boost_FIND_VERSION_MINOR}.${Boost_FIND_VERSION_PATCH}" - "${Boost_FIND_VERSION_MAJOR}.${Boost_FIND_VERSION_MINOR}") -else(Boost_FIND_VERSION_EXACT) - # The user has not requested an exact version. Among known - # versions, find those that are acceptable to the user request. - set(_Boost_KNOWN_VERSIONS ${Boost_ADDITIONAL_VERSIONS} - "1.38.0" "1.38" "1.37.0" "1.37" - "1.36.1" "1.36.0" "1.36" "1.35.1" "1.35.0" "1.35" "1.34.1" "1.34.0" - "1.34" "1.33.1" "1.33.0" "1.33") - set(_boost_TEST_VERSIONS) - if(Boost_FIND_VERSION) - set(_Boost_FIND_VERSION_SHORT "${Boost_FIND_VERSION_MAJOR}.${Boost_FIND_VERSION_MINOR}") - # Select acceptable versions. - foreach(version ${_Boost_KNOWN_VERSIONS}) - if(NOT "${version}" VERSION_LESS "${Boost_FIND_VERSION}") - # This version is high enough. - list(APPEND _boost_TEST_VERSIONS "${version}") - elseif("${version}.99" VERSION_EQUAL "${_Boost_FIND_VERSION_SHORT}.99") - # This version is a short-form for the requested version with - # the patch level dropped. - list(APPEND _boost_TEST_VERSIONS "${version}") - endif() - endforeach(version) - else(Boost_FIND_VERSION) - # Any version is acceptable. - set(_boost_TEST_VERSIONS "${_Boost_KNOWN_VERSIONS}") - endif(Boost_FIND_VERSION) -endif(Boost_FIND_VERSION_EXACT) - -# The reason that we failed to find Boost. This will be set to a -# user-friendly message when we fail to find some necessary piece of -# Boost. -set(Boost_ERROR_REASON) - -############################################ -# -# Check the existence of the libraries. -# -############################################ -# This macro was taken directly from the FindQt4.cmake file that is included -# with the CMake distribution. This is NOT my work. All work was done by the -# original authors of the FindQt4.cmake file. Only minor modifications were -# made to remove references to Qt and make this file more generally applicable -######################################################################### - -MACRO (_Boost_ADJUST_LIB_VARS basename) - IF (Boost_INCLUDE_DIR ) - IF (Boost_${basename}_LIBRARY_DEBUG AND Boost_${basename}_LIBRARY_RELEASE) - # if the generator supports configuration types then set - # optimized and debug libraries, or if the CMAKE_BUILD_TYPE has a value - IF (CMAKE_CONFIGURATION_TYPES OR CMAKE_BUILD_TYPE) - SET(Boost_${basename}_LIBRARY optimized ${Boost_${basename}_LIBRARY_RELEASE} debug ${Boost_${basename}_LIBRARY_DEBUG}) - ELSE(CMAKE_CONFIGURATION_TYPES OR CMAKE_BUILD_TYPE) - # if there are no configuration types and CMAKE_BUILD_TYPE has no value - # then just use the release libraries - SET(Boost_${basename}_LIBRARY ${Boost_${basename}_LIBRARY_RELEASE} ) - ENDIF(CMAKE_CONFIGURATION_TYPES OR CMAKE_BUILD_TYPE) - SET(Boost_${basename}_LIBRARIES optimized ${Boost_${basename}_LIBRARY_RELEASE} debug ${Boost_${basename}_LIBRARY_DEBUG}) - ENDIF (Boost_${basename}_LIBRARY_DEBUG AND Boost_${basename}_LIBRARY_RELEASE) - - # if only the release version was found, set the debug variable also to the release version - IF (Boost_${basename}_LIBRARY_RELEASE AND NOT Boost_${basename}_LIBRARY_DEBUG) - SET(Boost_${basename}_LIBRARY_DEBUG ${Boost_${basename}_LIBRARY_RELEASE}) - SET(Boost_${basename}_LIBRARY ${Boost_${basename}_LIBRARY_RELEASE}) - SET(Boost_${basename}_LIBRARIES ${Boost_${basename}_LIBRARY_RELEASE}) - ENDIF (Boost_${basename}_LIBRARY_RELEASE AND NOT Boost_${basename}_LIBRARY_DEBUG) - - # if only the debug version was found, set the release variable also to the debug version - IF (Boost_${basename}_LIBRARY_DEBUG AND NOT Boost_${basename}_LIBRARY_RELEASE) - SET(Boost_${basename}_LIBRARY_RELEASE ${Boost_${basename}_LIBRARY_DEBUG}) - SET(Boost_${basename}_LIBRARY ${Boost_${basename}_LIBRARY_DEBUG}) - SET(Boost_${basename}_LIBRARIES ${Boost_${basename}_LIBRARY_DEBUG}) - ENDIF (Boost_${basename}_LIBRARY_DEBUG AND NOT Boost_${basename}_LIBRARY_RELEASE) - - IF (Boost_${basename}_LIBRARY) - set(Boost_${basename}_LIBRARY ${Boost_${basename}_LIBRARY} CACHE FILEPATH "The Boost ${basename} library") - - # Remove superfluous "debug" / "optimized" keywords from - # Boost_LIBRARY_DIRS - FOREACH(_boost_my_lib ${Boost_${basename}_LIBRARY}) - GET_FILENAME_COMPONENT(_boost_my_lib_path "${_boost_my_lib}" PATH) - LIST(APPEND Boost_LIBRARY_DIRS ${_boost_my_lib_path}) - ENDFOREACH() - LIST(REMOVE_DUPLICATES Boost_LIBRARY_DIRS) - - set(Boost_LIBRARY_DIRS ${Boost_LIBRARY_DIRS} CACHE FILEPATH "Boost library directory") - SET(Boost_${basename}_FOUND ON CACHE INTERNAL "Whether the Boost ${basename} library found") - ENDIF (Boost_${basename}_LIBRARY) - - ENDIF (Boost_INCLUDE_DIR ) - # Make variables changeble to the advanced user - MARK_AS_ADVANCED( - Boost_${basename}_LIBRARY - Boost_${basename}_LIBRARY_RELEASE - Boost_${basename}_LIBRARY_DEBUG - ) -ENDMACRO (_Boost_ADJUST_LIB_VARS) - -# -# Runs compiler with "-dumpversion" and parses major/minor -# version with a regex. -# -FUNCTION(_Boost_COMPILER_DUMPVERSION _OUTPUT_VERSION) - - EXEC_PROGRAM(${CMAKE_CXX_COMPILER} - ARGS ${CMAKE_CXX_COMPILER_ARG1} -dumpversion - OUTPUT_VARIABLE _boost_COMPILER_VERSION - ) - STRING(REGEX REPLACE "([0-9])\\.([0-9])(\\.[0-9])?" "\\1\\2" - _boost_COMPILER_VERSION ${_boost_COMPILER_VERSION}) - - SET(${_OUTPUT_VERSION} ${_boost_COMPILER_VERSION} PARENT_SCOPE) -ENDFUNCTION() - - -#------------------------------------------------------------------------------- - - -SET( _boost_IN_CACHE TRUE) -IF(Boost_INCLUDE_DIR) - FOREACH(COMPONENT ${Boost_FIND_COMPONENTS}) - STRING(TOUPPER ${COMPONENT} COMPONENT) - IF(NOT Boost_${COMPONENT}_FOUND) - SET( _boost_IN_CACHE FALSE) - ENDIF(NOT Boost_${COMPONENT}_FOUND) - ENDFOREACH(COMPONENT) -ELSE(Boost_INCLUDE_DIR) - SET( _boost_IN_CACHE FALSE) -ENDIF(Boost_INCLUDE_DIR) - -IF (_boost_IN_CACHE) - # in cache already - SET(Boost_FOUND TRUE) - FOREACH(COMPONENT ${Boost_FIND_COMPONENTS}) - STRING(TOUPPER ${COMPONENT} COMPONENT) - _Boost_ADJUST_LIB_VARS( ${COMPONENT} ) - SET(Boost_LIBRARIES ${Boost_LIBRARIES} ${Boost_${COMPONENT}_LIBRARY}) - ENDFOREACH(COMPONENT) - SET(Boost_INCLUDE_DIRS ${Boost_INCLUDE_DIR}) - IF(Boost_VERSION AND NOT "${Boost_VERSION}" STREQUAL "0") - MATH(EXPR Boost_MAJOR_VERSION "${Boost_VERSION} / 100000") - MATH(EXPR Boost_MINOR_VERSION "${Boost_VERSION} / 100 % 1000") - MATH(EXPR Boost_SUBMINOR_VERSION "${Boost_VERSION} % 100") - ENDIF(Boost_VERSION AND NOT "${Boost_VERSION}" STREQUAL "0") - if(Boost_DEBUG) - message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] " - "boost ${Boost_MAJOR_VERSION}.${Boost_MINOR_VERSION}.${Boost_SUBMINOR_VERSION} " - "is already in the cache. For debugging messages, please clear the cache.") - endif() -ELSE (_boost_IN_CACHE) - # Need to search for boost - if(Boost_DEBUG) - message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] " - "Boost not in cache") - # Output some of their choices - message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] " - "_boost_TEST_VERSIONS = ${_boost_TEST_VERSIONS}") - message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] " - "Boost_USE_MULTITHREADED = ${Boost_USE_MULTITHREADED}") - message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] " - "Boost_USE_STATIC_LIBS = ${Boost_USE_STATIC_LIBS}") - endif() - - IF(WIN32) - # In windows, automatic linking is performed, so you do not have - # to specify the libraries. If you are linking to a dynamic - # runtime, then you can choose to link to either a static or a - # dynamic Boost library, the default is to do a static link. You - # can alter this for a specific library "whatever" by defining - # BOOST_WHATEVER_DYN_LINK to force Boost library "whatever" to be - # linked dynamically. Alternatively you can force all Boost - # libraries to dynamic link by defining BOOST_ALL_DYN_LINK. - - # This feature can be disabled for Boost library "whatever" by - # defining BOOST_WHATEVER_NO_LIB, or for all of Boost by defining - # BOOST_ALL_NO_LIB. - - # If you want to observe which libraries are being linked against - # then defining BOOST_LIB_DIAGNOSTIC will cause the auto-linking - # code to emit a #pragma message each time a library is selected - # for linking. - SET(Boost_LIB_DIAGNOSTIC_DEFINITIONS - "-DBOOST_LIB_DIAGNOSTIC" CACHE STRING "Boost diagnostic define") - ENDIF(WIN32) - - SET(_boost_INCLUDE_SEARCH_DIRS - C:/boost/include - C:/boost - "$ENV{ProgramFiles}/boost" - C:/library/boost - "C:/Program Files/boost" - "C:/Program Files (x86)/boost" - /sw/local/include - ) - - # If BOOST_ROOT was defined in the environment, use it. - if (NOT BOOST_ROOT AND NOT $ENV{BOOST_ROOT} STREQUAL "") - set(BOOST_ROOT $ENV{BOOST_ROOT}) - endif(NOT BOOST_ROOT AND NOT $ENV{BOOST_ROOT} STREQUAL "") - - # If BOOSTROOT was defined in the environment, use it. - if (NOT BOOST_ROOT AND NOT $ENV{BOOSTROOT} STREQUAL "") - set(BOOST_ROOT $ENV{BOOSTROOT}) - endif(NOT BOOST_ROOT AND NOT $ENV{BOOSTROOT} STREQUAL "") - - # If BOOST_INCLUDEDIR was defined in the environment, use it. - IF( NOT $ENV{BOOST_INCLUDEDIR} STREQUAL "" ) - set(BOOST_INCLUDEDIR $ENV{BOOST_INCLUDEDIR}) - ENDIF( NOT $ENV{BOOST_INCLUDEDIR} STREQUAL "" ) - - # If BOOST_LIBRARYDIR was defined in the environment, use it. - IF( NOT $ENV{BOOST_LIBRARYDIR} STREQUAL "" ) - set(BOOST_LIBRARYDIR $ENV{BOOST_LIBRARYDIR}) - ENDIF( NOT $ENV{BOOST_LIBRARYDIR} STREQUAL "" ) - - IF( BOOST_ROOT ) - file(TO_CMAKE_PATH ${BOOST_ROOT} BOOST_ROOT) - ENDIF( BOOST_ROOT ) - - if(Boost_DEBUG) - message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] " - "Declared as CMake or Environmental Variables:") - message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] " - " BOOST_ROOT = ${BOOST_ROOT}") - message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] " - " BOOST_INCLUDEDIR = ${BOOST_INCLUDEDIR}") - message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] " - " BOOST_LIBRARYDIR = ${BOOST_LIBRARYDIR}") - message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] " - "_boost_TEST_VERSIONS = ${_boost_TEST_VERSIONS}") - endif() - - IF( BOOST_ROOT ) - SET(_boost_INCLUDE_SEARCH_DIRS - ${BOOST_ROOT}/include - ${BOOST_ROOT} - ${_boost_INCLUDE_SEARCH_DIRS}) - ENDIF( BOOST_ROOT ) - - IF( BOOST_INCLUDEDIR ) - file(TO_CMAKE_PATH ${BOOST_INCLUDEDIR} BOOST_INCLUDEDIR) - SET(_boost_INCLUDE_SEARCH_DIRS - ${BOOST_INCLUDEDIR} ${_boost_INCLUDE_SEARCH_DIRS}) - ENDIF( BOOST_INCLUDEDIR ) - - # ------------------------------------------------------------------------ - # Search for Boost include DIR - # ------------------------------------------------------------------------ - # Try to find Boost by stepping backwards through the Boost versions - # we know about. - IF( NOT Boost_INCLUDE_DIR ) - # Build a list of path suffixes for each version. - SET(_boost_PATH_SUFFIXES) - FOREACH(_boost_VER ${_boost_TEST_VERSIONS}) - # Add in a path suffix, based on the required version, ideally - # we could read this from version.hpp, but for that to work we'd - # need to know the include dir already - set(_boost_BOOSTIFIED_VERSION) - - # Transform 1.35 => 1_35 and 1.36.0 => 1_36_0 - IF(_boost_VER MATCHES "[0-9]+\\.[0-9]+\\.[0-9]+") - STRING(REGEX REPLACE "([0-9]+)\\.([0-9]+)\\.([0-9]+)" "\\1_\\2_\\3" - _boost_BOOSTIFIED_VERSION ${_boost_VER}) - ELSEIF(_boost_VER MATCHES "[0-9]+\\.[0-9]+") - STRING(REGEX REPLACE "([0-9]+)\\.([0-9]+)" "\\1_\\2" - _boost_BOOSTIFIED_VERSION ${_boost_VER}) - ENDIF() - - list(APPEND _boost_PATH_SUFFIXES "boost-${_boost_BOOSTIFIED_VERSION}") - if(WIN32) - # For BoostPro's underscores (and others?) - list(APPEND _boost_PATH_SUFFIXES "boost_${_boost_BOOSTIFIED_VERSION}") - endif() - - ENDFOREACH(_boost_VER) - - if(Boost_DEBUG) - message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] " - "Include debugging info:") - message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] " - " _boost_INCLUDE_SEARCH_DIRS = ${_boost_INCLUDE_SEARCH_DIRS}") - message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] " - " _boost_PATH_SUFFIXES = ${_boost_PATH_SUFFIXES}") - endif() - - # Look for a standard boost header file. - FIND_PATH(Boost_INCLUDE_DIR - NAMES boost/config.hpp - HINTS ${_boost_INCLUDE_SEARCH_DIRS} - PATH_SUFFIXES ${_boost_PATH_SUFFIXES} - ) - ENDIF( NOT Boost_INCLUDE_DIR ) - - # ------------------------------------------------------------------------ - # Extract version information from version.hpp - # ------------------------------------------------------------------------ - - IF(Boost_INCLUDE_DIR) - # Extract Boost_VERSION and Boost_LIB_VERSION from version.hpp - # Read the whole file: - # - SET(BOOST_VERSION 0) - SET(BOOST_LIB_VERSION "") - FILE(READ "${Boost_INCLUDE_DIR}/boost/version.hpp" _boost_VERSION_HPP_CONTENTS) - if(Boost_DEBUG) - message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] " - "location of version.hpp: ${Boost_INCLUDE_DIR}/boost/version.hpp") - endif() - - STRING(REGEX REPLACE ".*#define BOOST_VERSION ([0-9]+).*" "\\1" Boost_VERSION "${_boost_VERSION_HPP_CONTENTS}") - STRING(REGEX REPLACE ".*#define BOOST_LIB_VERSION \"([0-9_]+)\".*" "\\1" Boost_LIB_VERSION "${_boost_VERSION_HPP_CONTENTS}") - - SET(Boost_LIB_VERSION ${Boost_LIB_VERSION} CACHE INTERNAL "The library version string for boost libraries") - SET(Boost_VERSION ${Boost_VERSION} CACHE INTERNAL "The version number for boost libraries") - - IF(NOT "${Boost_VERSION}" STREQUAL "0") - MATH(EXPR Boost_MAJOR_VERSION "${Boost_VERSION} / 100000") - MATH(EXPR Boost_MINOR_VERSION "${Boost_VERSION} / 100 % 1000") - MATH(EXPR Boost_SUBMINOR_VERSION "${Boost_VERSION} % 100") - - set(Boost_ERROR_REASON - "${Boost_ERROR_REASON}Boost version: ${Boost_MAJOR_VERSION}.${Boost_MINOR_VERSION}.${Boost_SUBMINOR_VERSION}\nBoost include path: ${Boost_INCLUDE_DIR}") - ENDIF(NOT "${Boost_VERSION}" STREQUAL "0") - if(Boost_DEBUG) - message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] " - "version.hpp reveals boost " - "${Boost_MAJOR_VERSION}.${Boost_MINOR_VERSION}.${Boost_SUBMINOR_VERSION}") - endif() - ELSE(Boost_INCLUDE_DIR) - set(Boost_ERROR_REASON - "${Boost_ERROR_REASON}Unable to find the Boost header files. Please set BOOST_ROOT to the root directory containing Boost or BOOST_INCLUDEDIR to the directory containing Boost's headers.") - ENDIF(Boost_INCLUDE_DIR) - - # ------------------------------------------------------------------------ - # Suffix initialization and compiler suffix detection. - # ------------------------------------------------------------------------ - - # Setting some more suffixes for the library - SET (Boost_LIB_PREFIX "") - if ( MSVC AND Boost_USE_STATIC_LIBS ) - SET (Boost_LIB_PREFIX "lib") - endif() - - if (Boost_COMPILER) - set(_boost_COMPILER ${Boost_COMPILER}) - if(Boost_DEBUG) - message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] " - "using user-specified Boost_COMPILER = ${_boost_COMPILER}") - endif() - else(Boost_COMPILER) - # Attempt to guess the compiler suffix - # NOTE: this is not perfect yet, if you experience any issues - # please report them and use the Boost_COMPILER variable - # to work around the problems. - if (MSVC90) - SET (_boost_COMPILER "-vc90") - elseif (MSVC80) - SET (_boost_COMPILER "-vc80") - elseif (MSVC71) - SET (_boost_COMPILER "-vc71") - elseif (MSVC70) # Good luck! - SET (_boost_COMPILER "-vc7") # yes, this is correct - elseif (MSVC60) # Good luck! - SET (_boost_COMPILER "-vc6") # yes, this is correct - elseif (BORLAND) - SET (_boost_COMPILER "-bcb") - elseif("${CMAKE_CXX_COMPILER}" MATCHES "icl" - OR "${CMAKE_CXX_COMPILER}" MATCHES "icpc") - if(WIN32) - set (_boost_COMPILER "-iw") - else() - set (_boost_COMPILER "-il") - endif() - elseif (MINGW) - if(${Boost_MAJOR_VERSION}.${Boost_MINOR_VERSION} VERSION_LESS 1.34) - SET(_boost_COMPILER "-mgw") # no GCC version encoding prior to 1.34 - else() - _Boost_COMPILER_DUMPVERSION(_boost_COMPILER_VERSION) - SET (_boost_COMPILER "-mgw${_boost_COMPILER_VERSION}") - endif() - elseif (UNIX) - if (CMAKE_COMPILER_IS_GNUCXX) - if(${Boost_MAJOR_VERSION}.${Boost_MINOR_VERSION} VERSION_LESS 1.34) - SET(_boost_COMPILER "-gcc") # no GCC version encoding prior to 1.34 - else() - _Boost_COMPILER_DUMPVERSION(_boost_COMPILER_VERSION) - # Determine which version of GCC we have. - IF(APPLE) - IF(Boost_MINOR_VERSION) - IF(${Boost_MINOR_VERSION} GREATER 35) - # In Boost 1.36.0 and newer, the mangled compiler name used - # on Mac OS X/Darwin is "xgcc". - SET(_boost_COMPILER "-xgcc${_boost_COMPILER_VERSION}") - ELSE(${Boost_MINOR_VERSION} GREATER 35) - # In Boost <= 1.35.0, there is no mangled compiler name for - # the Mac OS X/Darwin version of GCC. - SET(_boost_COMPILER "") - ENDIF(${Boost_MINOR_VERSION} GREATER 35) - ELSE(Boost_MINOR_VERSION) - # We don't know the Boost version, so assume it's - # pre-1.36.0. - SET(_boost_COMPILER "") - ENDIF(Boost_MINOR_VERSION) - ELSE() - SET (_boost_COMPILER "-gcc${_boost_COMPILER_VERSION}") - ENDIF() - endif() - endif (CMAKE_COMPILER_IS_GNUCXX) - endif() - if(Boost_DEBUG) - message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] " - "guessed _boost_COMPILER = ${_boost_COMPILER}") - endif() - endif(Boost_COMPILER) - - SET (_boost_MULTITHREADED "-mt") - if( NOT Boost_USE_MULTITHREADED ) - set (_boost_MULTITHREADED "") - endif() - if(Boost_DEBUG) - message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] " - "_boost_MULTITHREADED = ${_boost_MULTITHREADED}") - endif() - - SET( _boost_STATIC_TAG "") - set( _boost_ABI_TAG "") - IF (WIN32) - IF(MSVC) - SET (_boost_ABI_TAG "g") - ENDIF(MSVC) - IF( Boost_USE_STATIC_LIBS ) - SET( _boost_STATIC_TAG "-s") - ENDIF( Boost_USE_STATIC_LIBS ) - ENDIF(WIN32) - SET (_boost_ABI_TAG "${_boost_ABI_TAG}d") - if(Boost_DEBUG) - message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] " - "_boost_STATIC_TAG = ${_boost_STATIC_TAG}") - message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] " - "_boost_ABI_TAG = ${_boost_ABI_TAG}") - endif() - - # ------------------------------------------------------------------------ - # Begin finding boost libraries - # ------------------------------------------------------------------------ - - SET(_boost_LIBRARIES_SEARCH_DIRS - C:/boost/lib - C:/boost - "$ENV{ProgramFiles}/boost/boost_${Boost_MAJOR_VERSION}_${Boost_MINOR_VERSION}_${Boost_SUBMINOR_VERSION}/lib" - "$ENV{ProgramFiles}/boost" - C:/library/boost/stage/lib - "C:/Program Files/boost/stage/lib" - "C:/Program Files (x86)/boost/stage/lib" - C:/boost/lib - /sw/local/lib - ) - IF( BOOST_ROOT ) - SET(_boost_LIBRARIES_SEARCH_DIRS - ${BOOST_ROOT}/lib - ${BOOST_ROOT}/stage/lib - ${_boost_LIBRARIES_SEARCH_DIRS}) - ENDIF( BOOST_ROOT ) - - IF( BOOST_LIBRARYDIR ) - file(TO_CMAKE_PATH ${BOOST_LIBRARYDIR} BOOST_LIBRARYDIR) - SET(_boost_LIBRARIES_SEARCH_DIRS - ${BOOST_LIBRARYDIR} ${_boost_LIBRARIES_SEARCH_DIRS}) - ENDIF( BOOST_LIBRARYDIR ) - - if(Boost_DEBUG) - message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] " - "_boost_LIBRARIES_SEARCH_DIRS = ${_boost_LIBRARIES_SEARCH_DIRS}") - endif() - - FOREACH(COMPONENT ${Boost_FIND_COMPONENTS}) - STRING(TOUPPER ${COMPONENT} UPPERCOMPONENT) - SET( Boost_${UPPERCOMPONENT}_LIBRARY "Boost_${UPPERCOMPONENT}_LIBRARY-NOTFOUND" ) - SET( Boost_${UPPERCOMPONENT}_LIBRARY_RELEASE "Boost_${UPPERCOMPONENT}_LIBRARY_RELEASE-NOTFOUND" ) - SET( Boost_${UPPERCOMPONENT}_LIBRARY_DEBUG "Boost_${UPPERCOMPONENT}_LIBRARY_DEBUG-NOTFOUND") - - # Support preference of static libs by adjusting CMAKE_FIND_LIBRARY_SUFFIXES - IF( Boost_USE_STATIC_LIBS ) - SET( _boost_ORIG_CMAKE_FIND_LIBRARY_SUFFIXES ${CMAKE_FIND_LIBRARY_SUFFIXES}) - IF(WIN32) - SET(CMAKE_FIND_LIBRARY_SUFFIXES .lib .a ${CMAKE_FIND_LIBRARY_SUFFIXES}) - ELSE(WIN32) - SET(CMAKE_FIND_LIBRARY_SUFFIXES .a ${CMAKE_FIND_LIBRARY_SUFFIXES}) - ENDIF(WIN32) - ENDIF( Boost_USE_STATIC_LIBS ) - - FIND_LIBRARY(Boost_${UPPERCOMPONENT}_LIBRARY_RELEASE - NAMES ${Boost_LIB_PREFIX}boost_${COMPONENT}${_boost_COMPILER}${_boost_MULTITHREADED}-${Boost_LIB_VERSION} - ${Boost_LIB_PREFIX}boost_${COMPONENT}${_boost_COMPILER}${_boost_MULTITHREADED}${_boost_STATIC_TAG}-${Boost_LIB_VERSION} - ${Boost_LIB_PREFIX}boost_${COMPONENT}${_boost_MULTITHREADED}-${Boost_LIB_VERSION} - ${Boost_LIB_PREFIX}boost_${COMPONENT}${_boost_MULTITHREADED}${_boost_STATIC_TAG}-${Boost_LIB_VERSION} - ${Boost_LIB_PREFIX}boost_${COMPONENT}${_boost_MULTITHREADED} - ${Boost_LIB_PREFIX}boost_${COMPONENT}${_boost_MULTITHREADED}${_boost_STATIC_TAG} - ${Boost_LIB_PREFIX}boost_${COMPONENT} - HINTS ${_boost_LIBRARIES_SEARCH_DIRS} - ) - - FIND_LIBRARY(Boost_${UPPERCOMPONENT}_LIBRARY_DEBUG - NAMES ${Boost_LIB_PREFIX}boost_${COMPONENT}${_boost_COMPILER}${_boost_MULTITHREADED}-${_boost_ABI_TAG}-${Boost_LIB_VERSION} - ${Boost_LIB_PREFIX}boost_${COMPONENT}${_boost_COMPILER}${_boost_MULTITHREADED}${_boost_STATIC_TAG}${_boost_ABI_TAG}-${Boost_LIB_VERSION} - ${Boost_LIB_PREFIX}boost_${COMPONENT}${_boost_MULTITHREADED}-${_boost_ABI_TAG}-${Boost_LIB_VERSION} - ${Boost_LIB_PREFIX}boost_${COMPONENT}${_boost_MULTITHREADED}${_boost_STATIC_TAG}${_boost_ABI_TAG}-${Boost_LIB_VERSION} - ${Boost_LIB_PREFIX}boost_${COMPONENT}${_boost_MULTITHREADED}-${_boost_ABI_TAG} - ${Boost_LIB_PREFIX}boost_${COMPONENT}${_boost_MULTITHREADED}${_boost_STATIC_TAG}${_boost_ABI_TAG} - ${Boost_LIB_PREFIX}boost_${COMPONENT}-${_boost_ABI_TAG} - HINTS ${_boost_LIBRARIES_SEARCH_DIRS} - ) - - _Boost_ADJUST_LIB_VARS(${UPPERCOMPONENT}) - IF( Boost_USE_STATIC_LIBS ) - SET(CMAKE_FIND_LIBRARY_SUFFIXES ${_boost_ORIG_CMAKE_FIND_LIBRARY_SUFFIXES}) - ENDIF( Boost_USE_STATIC_LIBS ) - ENDFOREACH(COMPONENT) - # ------------------------------------------------------------------------ - # End finding boost libraries - # ------------------------------------------------------------------------ - - SET(Boost_INCLUDE_DIRS - ${Boost_INCLUDE_DIR} - ) - - SET(Boost_FOUND FALSE) - IF(Boost_INCLUDE_DIR) - SET( Boost_FOUND TRUE ) - - # Check the version of Boost against the requested version. - if (Boost_FIND_VERSION AND NOT Boost_FIND_VERSION_MINOR) - message(SEND_ERROR "When requesting a specific version of Boost, you must provide at least the major and minor version numbers, e.g., 1.34") - endif (Boost_FIND_VERSION AND NOT Boost_FIND_VERSION_MINOR) - if(Boost_MAJOR_VERSION LESS "${Boost_FIND_VERSION_MAJOR}" ) - set( Boost_FOUND FALSE ) - set(_Boost_VERSION_AGE "old") - elseif(Boost_MAJOR_VERSION EQUAL "${Boost_FIND_VERSION_MAJOR}" ) - if(Boost_MINOR_VERSION LESS "${Boost_FIND_VERSION_MINOR}" ) - set( Boost_FOUND FALSE ) - set(_Boost_VERSION_AGE "old") - elseif(Boost_MINOR_VERSION EQUAL "${Boost_FIND_VERSION_MINOR}" ) - if( Boost_FIND_VERSION_PATCH AND Boost_SUBMINOR_VERSION LESS "${Boost_FIND_VERSION_PATCH}" ) - set( Boost_FOUND FALSE ) - set(_Boost_VERSION_AGE "old") - endif( Boost_FIND_VERSION_PATCH AND Boost_SUBMINOR_VERSION LESS "${Boost_FIND_VERSION_PATCH}" ) - endif( Boost_MINOR_VERSION LESS "${Boost_FIND_VERSION_MINOR}" ) - endif( Boost_MAJOR_VERSION LESS "${Boost_FIND_VERSION_MAJOR}" ) - - if (Boost_FOUND AND Boost_FIND_VERSION_EXACT) - # If the user requested an exact version of Boost, check - # that. We already know that the Boost version we have is >= the - # requested version. - set(_Boost_VERSION_AGE "new") - - # If the user didn't specify a patchlevel, it's 0. - if (NOT Boost_FIND_VERSION_PATCH) - set(Boost_FIND_VERSION_PATCH 0) - endif (NOT Boost_FIND_VERSION_PATCH) - - # We'll set Boost_FOUND true again if we have an exact version match. - set(Boost_FOUND FALSE) - if(Boost_MAJOR_VERSION EQUAL "${Boost_FIND_VERSION_MAJOR}" ) - if(Boost_MINOR_VERSION EQUAL "${Boost_FIND_VERSION_MINOR}" ) - if(Boost_SUBMINOR_VERSION EQUAL "${Boost_FIND_VERSION_PATCH}" ) - set( Boost_FOUND TRUE ) - endif(Boost_SUBMINOR_VERSION EQUAL "${Boost_FIND_VERSION_PATCH}" ) - endif( Boost_MINOR_VERSION EQUAL "${Boost_FIND_VERSION_MINOR}" ) - endif( Boost_MAJOR_VERSION EQUAL "${Boost_FIND_VERSION_MAJOR}" ) - endif (Boost_FOUND AND Boost_FIND_VERSION_EXACT) - - if(NOT Boost_FOUND) - # State that we found a version of Boost that is too new or too old. - set(Boost_ERROR_REASON - "${Boost_ERROR_REASON}\nDetected version of Boost is too ${_Boost_VERSION_AGE}. Requested version was ${Boost_FIND_VERSION_MAJOR}.${Boost_FIND_VERSION_MINOR}") - if (Boost_FIND_VERSION_PATCH) - set(Boost_ERROR_REASON - "${Boost_ERROR_REASON}.${Boost_FIND_VERSION_PATCH}") - endif (Boost_FIND_VERSION_PATCH) - if (NOT Boost_FIND_VERSION_EXACT) - set(Boost_ERROR_REASON "${Boost_ERROR_REASON} (or newer)") - endif (NOT Boost_FIND_VERSION_EXACT) - set(Boost_ERROR_REASON "${Boost_ERROR_REASON}.") - endif (NOT Boost_FOUND) - - if (Boost_FOUND) - set(_boost_CHECKED_COMPONENT FALSE) - set(_Boost_MISSING_COMPONENTS) - foreach(COMPONENT ${Boost_FIND_COMPONENTS}) - string(TOUPPER ${COMPONENT} COMPONENT) - set(_boost_CHECKED_COMPONENT TRUE) - if(NOT Boost_${COMPONENT}_FOUND) - string(TOLOWER ${COMPONENT} COMPONENT) - list(APPEND _Boost_MISSING_COMPONENTS ${COMPONENT}) - set( Boost_FOUND FALSE) - endif(NOT Boost_${COMPONENT}_FOUND) - endforeach(COMPONENT) - endif (Boost_FOUND) - - if(Boost_DEBUG) - message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] Boost_FOUND = ${Boost_FOUND}") - endif() - - if (_Boost_MISSING_COMPONENTS) - # We were unable to find some libraries, so generate a sensible - # error message that lists the libraries we were unable to find. - set(Boost_ERROR_REASON - "${Boost_ERROR_REASON}\nThe following Boost libraries could not be found:\n") - foreach(COMPONENT ${_Boost_MISSING_COMPONENTS}) - set(Boost_ERROR_REASON - "${Boost_ERROR_REASON} boost_${COMPONENT}\n") - endforeach(COMPONENT) - - list(LENGTH Boost_FIND_COMPONENTS Boost_NUM_COMPONENTS_WANTED) - list(LENGTH _Boost_MISSING_COMPONENTS Boost_NUM_MISSING_COMPONENTS) - if (${Boost_NUM_COMPONENTS_WANTED} EQUAL ${Boost_NUM_MISSING_COMPONENTS}) - set(Boost_ERROR_REASON - "${Boost_ERROR_REASON}No Boost libraries were found. You may need to set Boost_LIBRARYDIR to the directory containing Boost libraries or BOOST_ROOT to the location of Boost.") - else (${Boost_NUM_COMPONENTS_WANTED} EQUAL ${Boost_NUM_MISSING_COMPONENTS}) - set(Boost_ERROR_REASON - "${Boost_ERROR_REASON}Some (but not all) of the required Boost libraries were found. You may need to install these additional Boost libraries. Alternatively, set Boost_LIBRARYDIR to the directory containing Boost libraries or BOOST_ROOT to the location of Boost.") - endif (${Boost_NUM_COMPONENTS_WANTED} EQUAL ${Boost_NUM_MISSING_COMPONENTS}) - endif (_Boost_MISSING_COMPONENTS) - - IF( NOT Boost_LIBRARY_DIRS AND NOT _boost_CHECKED_COMPONENT ) - # Compatibility Code for backwards compatibility with CMake - # 2.4's FindBoost module. - - # Look for the boost library path. - # Note that the user may not have installed any libraries - # so it is quite possible the Boost_LIBRARY_PATH may not exist. - SET(_boost_LIB_DIR ${Boost_INCLUDE_DIR}) - - IF("${_boost_LIB_DIR}" MATCHES "boost-[0-9]+") - GET_FILENAME_COMPONENT(_boost_LIB_DIR ${_boost_LIB_DIR} PATH) - ENDIF ("${_boost_LIB_DIR}" MATCHES "boost-[0-9]+") - - IF("${_boost_LIB_DIR}" MATCHES "/include$") - # Strip off the trailing "/include" in the path. - GET_FILENAME_COMPONENT(_boost_LIB_DIR ${_boost_LIB_DIR} PATH) - ENDIF("${_boost_LIB_DIR}" MATCHES "/include$") - - IF(EXISTS "${_boost_LIB_DIR}/lib") - SET (_boost_LIB_DIR ${_boost_LIB_DIR}/lib) - ELSE(EXISTS "${_boost_LIB_DIR}/lib") - IF(EXISTS "${_boost_LIB_DIR}/stage/lib") - SET(_boost_LIB_DIR ${_boost_LIB_DIR}/stage/lib) - ELSE(EXISTS "${_boost_LIB_DIR}/stage/lib") - SET(_boost_LIB_DIR "") - ENDIF(EXISTS "${_boost_LIB_DIR}/stage/lib") - ENDIF(EXISTS "${_boost_LIB_DIR}/lib") - - IF(_boost_LIB_DIR AND EXISTS "${_boost_LIB_DIR}") - SET(Boost_LIBRARY_DIRS ${_boost_LIB_DIR} CACHE FILEPATH "Boost library directory") - ENDIF(_boost_LIB_DIR AND EXISTS "${_boost_LIB_DIR}") - - ENDIF( NOT Boost_LIBRARY_DIRS AND NOT _boost_CHECKED_COMPONENT ) - - ELSE(Boost_INCLUDE_DIR) - SET( Boost_FOUND FALSE) - ENDIF(Boost_INCLUDE_DIR) - - IF (Boost_FOUND) - IF (NOT Boost_FIND_QUIETLY) - MESSAGE(STATUS "Boost version: ${Boost_MAJOR_VERSION}.${Boost_MINOR_VERSION}.${Boost_SUBMINOR_VERSION}") - ENDIF(NOT Boost_FIND_QUIETLY) - IF (NOT Boost_FIND_QUIETLY) - MESSAGE(STATUS "Found the following Boost libraries:") - ENDIF(NOT Boost_FIND_QUIETLY) - FOREACH ( COMPONENT ${Boost_FIND_COMPONENTS} ) - STRING( TOUPPER ${COMPONENT} UPPERCOMPONENT ) - IF ( Boost_${UPPERCOMPONENT}_FOUND ) - IF (NOT Boost_FIND_QUIETLY) - MESSAGE (STATUS " ${COMPONENT}") - ENDIF(NOT Boost_FIND_QUIETLY) - SET(Boost_LIBRARIES ${Boost_LIBRARIES} ${Boost_${UPPERCOMPONENT}_LIBRARY}) - ENDIF ( Boost_${UPPERCOMPONENT}_FOUND ) - ENDFOREACH(COMPONENT) - ELSE (Boost_FOUND) - IF (Boost_FIND_REQUIRED) - message(SEND_ERROR "Unable to find the requested Boost libraries.\n${Boost_ERROR_REASON}") - ENDIF(Boost_FIND_REQUIRED) - ENDIF(Boost_FOUND) - - # show the Boost_INCLUDE_DIRS AND Boost_LIBRARIES variables only in the advanced view - MARK_AS_ADVANCED(Boost_INCLUDE_DIR - Boost_INCLUDE_DIRS - Boost_LIBRARY_DIRS - ) -ENDIF(_boost_IN_CACHE) - +# - Try to find Boost include dirs and libraries +# Usage of this module as follows: +# +# NOTE: Take note of the Boost_ADDITIONAL_VERSIONS variable below. +# Due to Boost naming conventions and limitations in CMake this find +# module is NOT future safe with respect to Boost version numbers, +# and may break. +# +# == Using Header-Only libraries from within Boost: == +# +# find_package( Boost 1.36.0 ) +# if(Boost_FOUND) +# include_directories(${Boost_INCLUDE_DIRS}) +# add_executable(foo foo.cc) +# endif() +# +# +# == Using actual libraries from within Boost: == +# +# set(Boost_USE_STATIC_LIBS ON) +# set(Boost_USE_MULTITHREADED ON) +# find_package( Boost 1.36.0 COMPONENTS date_time filesystem system ... ) +# +# if(Boost_FOUND) +# include_directories(${Boost_INCLUDE_DIRS}) +# add_executable(foo foo.cc) +# target_link_libraries(foo ${Boost_LIBRARIES}) +# endif() +# +# +# The components list needs to contain actual names of boost libraries only, +# such as "date_time" for "libboost_date_time". If you're using parts of +# Boost that contain header files only (e.g. foreach) you do not need to +# specify COMPONENTS. +# +# You should provide a minimum version number that should be used. If you provide this +# version number and specify the REQUIRED attribute, this module will fail if it +# can't find the specified or a later version. If you specify a version number this is +# automatically put into the considered list of version numbers and thus doesn't need +# to be specified in the Boost_ADDITIONAL_VERSIONS variable (see below). +# +# NOTE for Visual Studio Users: +# Automatic linking is used on MSVC & Borland compilers by default when +# #including things in Boost. It's important to note that setting +# Boost_USE_STATIC_LIBS to OFF is NOT enough to get you dynamic linking, +# should you need this feature. Automatic linking typically uses static +# libraries with a few exceptions (Boost.Python is one). +# +# Please see the section below near Boost_LIB_DIAGNOSTIC_DEFINITIONS for +# more details. Adding a TARGET_LINK_LIBRARIES() as shown in the example +# above appears to cause VS to link dynamically if Boost_USE_STATIC_LIBS +# gets set to OFF. It is suggested you avoid automatic linking since it +# will make your application less portable. +# +# =========== The mess that is Boost_ADDITIONAL_VERSIONS (sorry?) ============ +# +# OK, so the Boost_ADDITIONAL_VERSIONS variable can be used to specify a list of +# boost version numbers that should be taken into account when searching +# for Boost. Unfortunately boost puts the version number into the +# actual filename for the libraries, so this variable will certainly be needed +# in the future when new Boost versions are released. +# +# Currently this module searches for the following version numbers: +# 1.33, 1.33.0, 1.33.1, 1.34, 1.34.0, 1.34.1, 1.35, 1.35.0, 1.35.1, +# 1.36, 1.36.0, 1.36.1, 1.37, 1.37.0, 1.38, 1.38.0, 1.39, 1.39.0, +# 1.40, 1.40.0, 1.41, 1.41.0 +# +# NOTE: If you add a new major 1.x version in Boost_ADDITIONAL_VERSIONS you should +# add both 1.x and 1.x.0 as shown above. Official Boost include directories +# omit the 3rd version number from include paths if it is 0 although not all +# binary Boost releases do so. +# +# SET(Boost_ADDITIONAL_VERSIONS "1.78" "1.78.0" "1.79" "1.79.0") +# +# ===================================== ============= ======================== +# +# Variables used by this module, they can change the default behaviour and +# need to be set before calling find_package: +# +# Boost_USE_MULTITHREADED Can be set to OFF to use the non-multithreaded +# boost libraries. If not specified, defaults +# to ON. +# +# Boost_USE_STATIC_LIBS Can be set to ON to force the use of the static +# boost libraries. Defaults to OFF. +# +# Other Variables used by this module which you may want to set. +# +# Boost_ADDITIONAL_VERSIONS A list of version numbers to use for searching +# the boost include directory. Please see +# the documentation above regarding this +# annoying, but necessary variable :( +# +# Boost_DEBUG Set this to TRUE to enable debugging output +# of FindBoost.cmake if you are having problems. +# Please enable this before filing any bug +# reports. +# +# Boost_DETAILED_FAILURE_MSG FindBoost doesn't output detailed information +# about why it failed or how to fix the problem +# unless this is set to TRUE or the REQUIRED +# keyword is specified in find_package(). +# [Since CMake 2.8.0] +# +# Boost_COMPILER Set this to the compiler suffix used by Boost +# (e.g. "-gcc43") if FindBoost has problems finding +# the proper Boost installation +# +# These last three variables are available also as environment variables: +# +# BOOST_ROOT or BOOSTROOT The preferred installation prefix for searching for +# Boost. Set this if the module has problems finding +# the proper Boost installation. +# +# BOOST_INCLUDEDIR Set this to the include directory of Boost, if the +# module has problems finding the proper Boost installation +# +# BOOST_LIBRARYDIR Set this to the lib directory of Boost, if the +# module has problems finding the proper Boost installation +# +# Variables defined by this module: +# +# Boost_FOUND System has Boost, this means the include dir was +# found, as well as all the libraries specified in +# the COMPONENTS list. +# +# Boost_INCLUDE_DIRS Boost include directories: not cached +# +# Boost_INCLUDE_DIR This is almost the same as above, but this one is +# cached and may be modified by advanced users +# +# Boost_LIBRARIES Link to these to use the Boost libraries that you +# specified: not cached +# +# Boost_LIBRARY_DIRS The path to where the Boost library files are. +# +# Boost_VERSION The version number of the boost libraries that +# have been found, same as in version.hpp from Boost +# +# Boost_LIB_VERSION The version number in filename form as +# it's appended to the library filenames +# +# Boost_MAJOR_VERSION major version number of boost +# Boost_MINOR_VERSION minor version number of boost +# Boost_SUBMINOR_VERSION subminor version number of boost +# +# Boost_LIB_DIAGNOSTIC_DEFINITIONS [WIN32 Only] You can call +# add_definitions(${Boost_LIB_DIAGNOSTIC_DEFINITIONS}) +# to have diagnostic information about Boost's +# automatic linking outputted during compilation time. +# +# For each component you specify in find_package(), the following (UPPER-CASE) +# variables are set. You can use these variables if you would like to pick and +# choose components for your targets instead of just using Boost_LIBRARIES. +# +# Boost_${COMPONENT}_FOUND True IF the Boost library "component" was found. +# +# Boost_${COMPONENT}_LIBRARY Contains the libraries for the specified Boost +# "component" (includes debug and optimized keywords +# when needed). + +#============================================================================= +# Copyright 2006-2009 Kitware, Inc. +# Copyright 2006-2008 Andreas Schneider <ma...@cy...> +# Copyright 2007 Wengo +# Copyright 2007 Mike Jackson +# Copyright 2008 Andreas Pakulat <ap...@gm...> +# Copyright 2008-2009 Philip Lowman <ph...@yh...> +# +# Distributed under the OSI-approved BSD License (the "License"); +# see accompanying file Copyright.txt for details. +# +# This software is distributed WITHOUT ANY WARRANTY; without even the +# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +# See the License for more information. +#============================================================================= +# (To distributed this file outside of CMake, substitute the full +# License text for the above reference.) + +#------------------------------------------------------------------------------- +# FindBoost functions & macros +# +############################################ +# +# Check the existence of the libraries. +# +############################################ +# This macro was taken directly from the FindQt4.cmake file that is included +# with the CMake distribution. This is NOT my work. All work was done by the +# original authors of the FindQt4.cmake file. Only minor modifications were +# made to remove references to Qt and make this file more generally applicable +# And ELSE/ENDIF pairs were removed for readability. +######################################################################### + +MACRO (_Boost_ADJUST_LIB_VARS basename) + IF (Boost_INCLUDE_DIR ) + IF (Boost_${basename}_LIBRARY_DEBUG AND Boost_${basename}_LIBRARY_RELEASE) + # if the generator supports configuration types then set + # optimized and debug libraries, or if the CMAKE_BUILD_TYPE has a value + IF... [truncated message content] |
From: <a-...@us...> - 2010-03-04 02:05:19
|
Revision: 187 http://simspark.svn.sourceforge.net/simspark/?rev=187&view=rev Author: a-held Date: 2010-03-04 02:05:13 +0000 (Thu, 04 Mar 2010) Log Message: ----------- Change makefiles to link ODE with odeimps module and not with oxygen Modified Paths: -------------- trunk/spark/lib/oxygen/CMakeLists.txt trunk/spark/plugin/odeimps/CMakeLists.txt Modified: trunk/spark/lib/oxygen/CMakeLists.txt =================================================================== --- trunk/spark/lib/oxygen/CMakeLists.txt 2010-02-28 21:46:06 UTC (rev 186) +++ trunk/spark/lib/oxygen/CMakeLists.txt 2010-03-04 02:05:13 UTC (rev 187) @@ -302,7 +302,7 @@ add_library(oxygen ${oxygen_LIB_SRCS} ${oxygen_LIB_HDRS}) target_link_libraries(oxygen rcssnet3D ${Boost_LIBRARIES} - ${ODE_LIBRARY} ${oxygen_require_libs}) + ${oxygen_require_libs}) set_target_properties(oxygen PROPERTIES VERSION ${OXYGEN_VERSION} SOVERSION ${OXYGEN_SO_VERSION} DEBUG_POSTFIX _debug) Modified: trunk/spark/plugin/odeimps/CMakeLists.txt =================================================================== --- trunk/spark/plugin/odeimps/CMakeLists.txt 2010-02-28 21:46:06 UTC (rev 186) +++ trunk/spark/plugin/odeimps/CMakeLists.txt 2010-03-04 02:05:13 UTC (rev 187) @@ -106,7 +106,7 @@ add_library(odeimps MODULE ${odeimps_LIB_SRCS}) -target_link_libraries(odeimps ${spark_libs}) +target_link_libraries(odeimps ${ODE_LIBRARY} ${spark_libs}) if (NOT APPLE) set_target_properties(odeimps PROPERTIES VERSION 0.0.0 SOVERSION 0) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <he...@us...> - 2010-06-06 22:44:57
|
Revision: 212 http://simspark.svn.sourceforge.net/simspark/?rev=212&view=rev Author: hedayat Date: 2010-06-06 22:44:51 +0000 (Sun, 06 Jun 2010) Log Message: ----------- Monitor Logger now logs game state data in fixed intervals, so that such data will not be missed Some more release notes Modified Paths: -------------- trunk/spark/ChangeLog trunk/spark/NEWS trunk/spark/RELEASE trunk/spark/lib/oxygen/simulationserver/monitorlogger.cpp trunk/spark/lib/oxygen/simulationserver/monitorlogger.h Modified: trunk/spark/ChangeLog =================================================================== --- trunk/spark/ChangeLog 2010-06-06 22:39:29 UTC (rev 211) +++ trunk/spark/ChangeLog 2010-06-06 22:44:51 UTC (rev 212) @@ -1,3 +1,14 @@ +2010-06-07 Hedayat Vatankhah <he...@gr...> + + * NEWS: + * RELEASE: + - prepared for 0.2.1 release + + * lib/oxygen/simulationserver/monitorlogger.h: + * lib/oxygen/simulationserver/monitorlogger.cpp: + - request complete game information every 10 seconds so that it'll receive + new game state information + 2010-06-06 Hedayat Vatankhah <he...@gr...> * lib/oxygen/monitorserver/monitorserver.h: Modified: trunk/spark/NEWS =================================================================== --- trunk/spark/NEWS 2010-06-06 22:39:29 UTC (rev 211) +++ trunk/spark/NEWS 2010-06-06 22:44:51 UTC (rev 212) @@ -1,3 +1,18 @@ +[0.2.1] +This release of simspark is prepared for RoboCup 2010 competitions in Singapore. +In this release you can find some bug and compilation fixes, improved Windows +support and some new features such as the potential of using different +physical simulation engines. + +* New features: + - The core physics system does no longer depend on ODE (Thanks to Andreas). + ODE implementation is now provided as a plugin. + +* Fixes: + - Compilation fixes on newer compilers (VS 2010) + - Fixed some bugs on 64 bit systems and in multi-threaded mode. It is (hopefully) + possible to run multi-threaded games while logging is enabled + [0.2] In this release you can find some bug and compilation fixes, improved Windows support and some new features including a new sensor and features to facilitate Modified: trunk/spark/RELEASE =================================================================== --- trunk/spark/RELEASE 2010-06-06 22:39:29 UTC (rev 211) +++ trunk/spark/RELEASE 2010-06-06 22:44:51 UTC (rev 212) @@ -1,5 +1,6 @@ RELEASE News of simspark-0.2.1 +This release of simspark is prepared for RoboCup 2010 competitions in Singapore. In this release you can find some bug and compilation fixes, improved Windows support and some new features such as the potential of using different physical simulation engines. @@ -10,7 +11,8 @@ * Fixes: - Compilation fixes on newer compilers (VS 2010) - - Fixed some bugs on 64 bit systems and in multi-threaded mode + - Fixed some bugs on 64 bit systems and in multi-threaded mode. It is (hopefully) + possible to run multi-threaded games while logging is enabled You can get the package on the Simspark page on SourceForge at http://sourceforge.net/projects/simspark/ Modified: trunk/spark/lib/oxygen/simulationserver/monitorlogger.cpp =================================================================== --- trunk/spark/lib/oxygen/simulationserver/monitorlogger.cpp 2010-06-06 22:39:29 UTC (rev 211) +++ trunk/spark/lib/oxygen/simulationserver/monitorlogger.cpp 2010-06-06 22:44:51 UTC (rev 212) @@ -29,7 +29,8 @@ using namespace boost; using namespace std; -MonitorLogger::MonitorLogger() : SimControlNode(), mFullStateLogged(0) +MonitorLogger::MonitorLogger() : SimControlNode(), mFullStateLogged(0), + mFullStateLoggedTime(0) { } @@ -70,9 +71,12 @@ string info; boost::shared_ptr<Scene> scene = GetActiveScene(); - if (scene.get() != 0 - && scene->GetModifiedNum() > mFullStateLogged ) + // The logger might miss some information as it runs at a lower rate + if (mTime - mFullStateLoggedTime > 3.0 || + (scene.get() != 0 && scene->GetModifiedNum() > mFullStateLogged) + ) { + mFullStateLoggedTime = mTime; mFullStateLogged = scene->GetModifiedNum(); info = mMonitorServer->GetMonitorHeaderInfo(); } Modified: trunk/spark/lib/oxygen/simulationserver/monitorlogger.h =================================================================== --- trunk/spark/lib/oxygen/simulationserver/monitorlogger.h 2010-06-06 22:39:29 UTC (rev 211) +++ trunk/spark/lib/oxygen/simulationserver/monitorlogger.h 2010-06-06 22:44:51 UTC (rev 212) @@ -61,6 +61,9 @@ /** number of full state logged */ int mFullStateLogged; + + /** the time of the last full state logging */ + float mFullStateLoggedTime; }; DECLARE_CLASS(MonitorLogger); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <he...@us...> - 2010-06-07 13:13:36
|
Revision: 213 http://simspark.svn.sourceforge.net/simspark/?rev=213&view=rev Author: hedayat Date: 2010-06-07 13:13:28 +0000 (Mon, 07 Jun 2010) Log Message: ----------- Fixed accelerometer installation on MacOSX Look into ENV{ODE_HOME} instead of ENV{OGRE_HOME} to find ODE library Reapply the accelerometer filter to remain compatible with simspark-0.2 Modified Paths: -------------- trunk/spark/ChangeLog trunk/spark/cmake/FindODE.cmake trunk/spark/plugin/accelerometer/CMakeLists.txt trunk/spark/plugin/accelerometer/accelerometer.cpp Modified: trunk/spark/ChangeLog =================================================================== --- trunk/spark/ChangeLog 2010-06-06 22:44:51 UTC (rev 212) +++ trunk/spark/ChangeLog 2010-06-07 13:13:28 UTC (rev 213) @@ -4,6 +4,16 @@ * RELEASE: - prepared for 0.2.1 release + * plugin/accelerometer/accelerometer.cpp: + - reapply the filter to remain compatible with simspark-0.2 for RoboCup 2010 + + * cmake/FindODE.cmake: + - lookup in the directory specified in ODE_HOME env. variable instead of + OGRE_HOME + + * plugin/accelerometer/CMakeLists.txt: + - fixed accelerometer installation on MacOSX + * lib/oxygen/simulationserver/monitorlogger.h: * lib/oxygen/simulationserver/monitorlogger.cpp: - request complete game information every 10 seconds so that it'll receive Modified: trunk/spark/cmake/FindODE.cmake =================================================================== --- trunk/spark/cmake/FindODE.cmake 2010-06-06 22:44:51 UTC (rev 212) +++ trunk/spark/cmake/FindODE.cmake 2010-06-07 13:13:28 UTC (rev 213) @@ -46,7 +46,7 @@ FIND_PATH(ODE_INCLUDE_DIR ode/ode.h /usr/include /usr/local/include - $ENV{OGRE_HOME}/include # OGRE SDK on WIN32 + $ENV{ODE_HOME}/include $ENV{INCLUDE} C:/library/ode/include "C:/Program Files/ode/include" @@ -59,7 +59,7 @@ /usr/lib /usr/lib64 /usr/local/lib - $ENV{OGRE_HOME}/lib # OGRE SDK on WIN32 + $ENV{ODE_HOME}/lib C:/library/ode/lib/ "C:/Program Files/ode/lib/" "C:/Program Files (x86)/ode/lib/" Modified: trunk/spark/plugin/accelerometer/CMakeLists.txt =================================================================== --- trunk/spark/plugin/accelerometer/CMakeLists.txt 2010-06-06 22:44:51 UTC (rev 212) +++ trunk/spark/plugin/accelerometer/CMakeLists.txt 2010-06-07 13:13:28 UTC (rev 213) @@ -10,7 +10,8 @@ target_link_libraries(accelerometer ${spark_libs} ${Boost_LIBRARIES}) -set_target_properties(accelerometer PROPERTIES VERSION 0.0.0 SOVERSION 0) if (NOT APPLE) - install(TARGETS accelerometer DESTINATION ${LIBDIR}/${CMAKE_PROJECT_NAME}) + set_target_properties(accelerometer PROPERTIES VERSION 0.0.0 SOVERSION 0) endif (NOT APPLE) + +install(TARGETS accelerometer DESTINATION ${LIBDIR}/${CMAKE_PROJECT_NAME}) Modified: trunk/spark/plugin/accelerometer/accelerometer.cpp =================================================================== --- trunk/spark/plugin/accelerometer/accelerometer.cpp 2010-06-06 22:44:51 UTC (rev 212) +++ trunk/spark/plugin/accelerometer/accelerometer.cpp 2010-06-07 13:13:28 UTC (rev 213) @@ -84,5 +84,10 @@ Matrix invRot = mBody->GetRotation(); invRot.InvertRotationMatrix(); - mAcc = invRot * acc; +// mAcc = invRot * acc; + acc = invRot * acc; + + float k = 0.9; + mAcc = k*mAcc + (1-k)*acc; + mLastVel = vel; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <he...@us...> - 2010-07-08 14:14:30
|
Revision: 220 http://simspark.svn.sourceforge.net/simspark/?rev=220&view=rev Author: hedayat Date: 2010-07-08 14:14:23 +0000 (Thu, 08 Jul 2010) Log Message: ----------- Removed the ACC perceptor's filter after 2010 competitions Modified Paths: -------------- trunk/spark/ChangeLog trunk/spark/plugin/accelerometer/accelerometer.cpp Modified: trunk/spark/ChangeLog =================================================================== --- trunk/spark/ChangeLog 2010-06-15 01:13:08 UTC (rev 219) +++ trunk/spark/ChangeLog 2010-07-08 14:14:23 UTC (rev 220) @@ -1,3 +1,8 @@ +2010-06-08 Hedayat Vatankhah <he...@gr...> + + * plugin/accelerometer/accelerometer.cpp: + - remove the filter again (after 0.2.1 release) + 2010-06-07 Hedayat Vatankhah <he...@gr...> * NEWS: Modified: trunk/spark/plugin/accelerometer/accelerometer.cpp =================================================================== --- trunk/spark/plugin/accelerometer/accelerometer.cpp 2010-06-15 01:13:08 UTC (rev 219) +++ trunk/spark/plugin/accelerometer/accelerometer.cpp 2010-07-08 14:14:23 UTC (rev 220) @@ -84,10 +84,5 @@ Matrix invRot = mBody->GetRotation(); invRot.InvertRotationMatrix(); -// mAcc = invRot * acc; - acc = invRot * acc; - - float k = 0.9; - mAcc = k*mAcc + (1-k)*acc; - mLastVel = vel; + mAcc = invRot * acc; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sgv...@us...> - 2010-09-28 16:20:57
|
Revision: 223 http://simspark.svn.sourceforge.net/simspark/?rev=223&view=rev Author: sgvandijk Date: 2010-09-28 16:20:51 +0000 (Tue, 28 Sep 2010) Log Message: ----------- * plugin/inputsdl/inputsystemsdl.cpp - do not init SDL video in inputsystem Modified Paths: -------------- trunk/spark/ChangeLog trunk/spark/plugin/inputsdl/inputsystemsdl.cpp Modified: trunk/spark/ChangeLog =================================================================== --- trunk/spark/ChangeLog 2010-09-28 16:18:10 UTC (rev 222) +++ trunk/spark/ChangeLog 2010-09-28 16:20:51 UTC (rev 223) @@ -1,3 +1,8 @@ +2010-09-28 Sander van Dijk <sgv...@gm...> + + * plugin/inputsdl/inputsystemsdl.cpp + - do not init SDL video in inputsystem + 2010-06-08 Hedayat Vatankhah <he...@gr...> * plugin/accelerometer/accelerometer.cpp: Modified: trunk/spark/plugin/inputsdl/inputsystemsdl.cpp =================================================================== --- trunk/spark/plugin/inputsdl/inputsystemsdl.cpp 2010-09-28 16:18:10 UTC (rev 222) +++ trunk/spark/plugin/inputsdl/inputsystemsdl.cpp 2010-09-28 16:20:51 UTC (rev 223) @@ -87,11 +87,13 @@ // input is part of the video subsystem (because of event loops, etc..) if (!SDL_WasInit(SDL_INIT_VIDEO)) { + /* if (SDL_Init(SDL_INIT_VIDEO | SDL_INIT_NOPARACHUTE) < 0) { GetLog()->Error() << "ERROR: (InputSystemSDL) SDL not initialized!\n"; return false; } + */ // SDL_SetVideoMode(0,0,0,0); // static SDL_SysWMinfo pInfo; // SDL_VERSION(&pInfo.version); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <yx...@us...> - 2010-12-14 17:07:20
|
Revision: 226 http://simspark.svn.sourceforge.net/simspark/?rev=226&view=rev Author: yxu Date: 2010-12-14 17:07:14 +0000 (Tue, 14 Dec 2010) Log Message: ----------- support ruby 1.9.1 Modified Paths: -------------- trunk/spark/cmake/FindRuby.cmake trunk/spark/lib/zeitgeist/scriptserver/gcvalue.h Modified: trunk/spark/cmake/FindRuby.cmake =================================================================== --- trunk/spark/cmake/FindRuby.cmake 2010-11-15 00:01:13 UTC (rev 225) +++ trunk/spark/cmake/FindRuby.cmake 2010-12-14 17:07:14 UTC (rev 226) @@ -17,7 +17,7 @@ # RUBY_LIBDIR=`$RUBY -r rbconfig -e 'printf("%s",Config::CONFIG@<:@"libdir"@:>@)'` # RUBY_LIBRUBYARG=`$RUBY -r rbconfig -e 'printf("%s",Config::CONFIG@<:@"LIBRUBYARG_SHARED"@:>@)'` -FIND_PROGRAM(RUBY_EXECUTABLE NAMES ruby ruby1.8 ruby18 ruby1.9 ruby19) +FIND_PROGRAM(RUBY_EXECUTABLE NAMES ruby ruby1.8 ruby18 ruby1.9 ruby19 ruby1.9.1) IF(RUBY_EXECUTABLE AND NOT RUBY_ARCH_DIR) @@ -86,7 +86,7 @@ # search the ruby library, the version for MSVC can have the "msvc" prefix and the "static" suffix FIND_LIBRARY(RUBY_LIBRARY - NAMES ruby ruby1.8 ruby1.9 + NAMES ruby ruby1.8 ruby1.9 ruby-1.9.1 msvcrt-ruby18 msvcrt-ruby19 msvcrt-ruby191 msvcrt-ruby18-static msvcrt-ruby19-static msvcrt-ruby191-static PATHS ${RUBY_POSSIBLE_LIB_DIR} C:/library/ruby/lib/ Modified: trunk/spark/lib/zeitgeist/scriptserver/gcvalue.h =================================================================== --- trunk/spark/lib/zeitgeist/scriptserver/gcvalue.h 2010-11-15 00:01:13 UTC (rev 225) +++ trunk/spark/lib/zeitgeist/scriptserver/gcvalue.h 2010-12-14 17:07:14 UTC (rev 226) @@ -29,6 +29,10 @@ #include <string> #include <zeitgeist/zeitgeist_defines.h> +#ifndef STR2CSTR +#define STR2CSTR StringValueCStr +#endif + namespace zeitgeist { /** \class GCValue is a ruby VALUE wrapper. It is responsible to This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <yx...@us...> - 2010-12-17 00:22:05
|
Revision: 235 http://simspark.svn.sourceforge.net/simspark/?rev=235&view=rev Author: yxu Date: 2010-12-17 00:21:59 +0000 (Fri, 17 Dec 2010) Log Message: ----------- multi-threads works! (do we really need mutex?!) Modified Paths: -------------- trunk/spark/plugin/imageperceptor/imagerender.cpp trunk/spark/spark/spark.rb Modified: trunk/spark/plugin/imageperceptor/imagerender.cpp =================================================================== --- trunk/spark/plugin/imageperceptor/imagerender.cpp 2010-12-17 00:21:40 UTC (rev 234) +++ trunk/spark/plugin/imageperceptor/imagerender.cpp 2010-12-17 00:21:59 UTC (rev 235) @@ -164,6 +164,6 @@ // unbind FBO glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, 0); #endif -// mRenderServer->SetCamera(oldCamera); + mRenderServer->SetCamera(oldCamera); } Modified: trunk/spark/spark/spark.rb =================================================================== --- trunk/spark/spark/spark.rb 2010-12-17 00:21:40 UTC (rev 234) +++ trunk/spark/spark/spark.rb 2010-12-17 00:21:59 UTC (rev 235) @@ -283,7 +283,7 @@ simulationServer = sparkGetSimulationServer() if (simulationServer != nil) - simulationServer.setMultiThreads(false); + simulationServer.setMultiThreads(true); simulationServer.initControlNode('oxygen/AgentControl','AgentControl') # set auto speed adjust mode. This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <he...@us...> - 2010-12-19 19:19:05
|
Revision: 241 http://simspark.svn.sourceforge.net/simspark/?rev=241&view=rev Author: hedayat Date: 2010-12-19 19:18:59 +0000 (Sun, 19 Dec 2010) Log Message: ----------- Added boost's date_time library to the list of required libraries Modified Paths: -------------- trunk/spark/CMakeLists.txt trunk/spark/ChangeLog Modified: trunk/spark/CMakeLists.txt =================================================================== --- trunk/spark/CMakeLists.txt 2010-12-17 00:24:51 UTC (rev 240) +++ trunk/spark/CMakeLists.txt 2010-12-19 19:18:59 UTC (rev 241) @@ -41,7 +41,7 @@ find_package(Ruby REQUIRED) find_package(Freetype REQUIRED) find_package(DevIL REQUIRED) -find_package(Boost REQUIRED thread COMPONENTS regex) +find_package(Boost REQUIRED thread COMPONENTS regex date_time) find_package(wxWidgets COMPONENTS gl base core) find_package(ODE REQUIRED) find_package(OpenGL REQUIRED) Modified: trunk/spark/ChangeLog =================================================================== --- trunk/spark/ChangeLog 2010-12-17 00:24:51 UTC (rev 240) +++ trunk/spark/ChangeLog 2010-12-19 19:18:59 UTC (rev 241) @@ -24,6 +24,11 @@ * test/scenetest/main.cpp - be able to render camera image on and off screen +2010-12-14 Hedayat Vatankhah <hed...@gm...> + + * CMakeLists.txt: + - added boost date_time library to the required libs + 2010-12-14 Yuan Xu <xu...@in...> * plugin/imageperceptor This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sgv...@us...> - 2011-03-02 17:23:06
|
Revision: 248 http://simspark.svn.sourceforge.net/simspark/?rev=248&view=rev Author: sgvandijk Date: 2011-03-02 17:22:58 +0000 (Wed, 02 Mar 2011) Log Message: ----------- - Take out accidental joint feedback request - Some initialisation - Readd inputControl loop (at correct place) Modified Paths: -------------- trunk/spark/lib/oxygen/monitorserver/monitorserver.cpp trunk/spark/lib/oxygen/sceneserver/scene.cpp trunk/spark/lib/oxygen/simulationserver/simulationserver.cpp trunk/spark/lib/oxygen/simulationserver/simulationserver.h trunk/spark/plugin/odeimps/odehingejoint.cpp Modified: trunk/spark/lib/oxygen/monitorserver/monitorserver.cpp =================================================================== --- trunk/spark/lib/oxygen/monitorserver/monitorserver.cpp 2011-02-26 00:09:51 UTC (rev 247) +++ trunk/spark/lib/oxygen/monitorserver/monitorserver.cpp 2011-03-02 17:22:58 UTC (rev 248) @@ -30,7 +30,7 @@ using namespace boost; using namespace std; -MonitorServer::MonitorServer() : Node() +MonitorServer::MonitorServer() : Node(), mDataCycle(0) { } Modified: trunk/spark/lib/oxygen/sceneserver/scene.cpp =================================================================== --- trunk/spark/lib/oxygen/sceneserver/scene.cpp 2011-02-26 00:09:51 UTC (rev 247) +++ trunk/spark/lib/oxygen/sceneserver/scene.cpp 2011-03-02 17:22:58 UTC (rev 248) @@ -26,7 +26,7 @@ using namespace salt; using namespace zeitgeist; -Scene::Scene() : BaseNode(), mModified(false), mModifiedNum(0) +Scene::Scene() : BaseNode(), mModified(false), mModifiedNum(0), mLastCacheUpdate(0) { } Modified: trunk/spark/lib/oxygen/simulationserver/simulationserver.cpp =================================================================== --- trunk/spark/lib/oxygen/simulationserver/simulationserver.cpp 2011-02-26 00:09:51 UTC (rev 247) +++ trunk/spark/lib/oxygen/simulationserver/simulationserver.cpp 2011-03-02 17:22:58 UTC (rev 248) @@ -312,15 +312,16 @@ Init(argc, argv); GetLog()->Normal() << "(SimulationServer) entering runloop\n"; + boost::shared_ptr<SimControlNode> inputCtr = GetControlNode("InputControl"); + if ( mMultiThreads ) { GetLog()->Normal()<< "(SimulationServer) running in multi-threads\n"; - RunMultiThreaded(); + RunMultiThreaded(inputCtr); } else { GetLog()->Normal()<< "(SimulationServer) running in single thread\n"; - boost::shared_ptr<SimControlNode> inputCtr = GetControlNode("InputControl"); if ( !mAutoTime && inputCtr.get() == 0 ) { GetLog()->Error()<< "(SimulationServer) ERROR: can not get InputControl\n"; @@ -391,7 +392,7 @@ return mSceneServer.get(); } -void SimulationServer::RunMultiThreaded() +void SimulationServer::RunMultiThreaded(boost::shared_ptr<SimControlNode> &inputCtr) { if (mSimStep == 0) { @@ -428,19 +429,34 @@ { ++mCycle; + // Signal start of cycle mThreadBarrier->wait(); if (mExit) mExitThreads = true; + // Wait for SimControlNodes' acts at the begining of a cycle - mThreadBarrier->wait(); finalDelta = initDelta = mSumDeltaTime; mSceneServer->PrePhysicsUpdate(mSimStep); mSceneServer->PhysicsUpdate(mSimStep); + if (mAutoTime) - AdvanceTime(mSimStep); + { + AdvanceTime(mSimStep); + } + + else + { + if (inputCtr.get() != 0) + { + while (int(mSumDeltaTime*100) < int(mSimStep*100)) + { + inputCtr->StartCycle();// advance the time + } + } + } UpdateDeltaTimeAfterStep(finalDelta); @@ -454,11 +470,13 @@ mSceneServer->PostPhysicsUpdate(); mGameControlServer->Update(finalStep); mSimTime += finalStep; + if (renderControl && renderControl->GetTime() - mSimTime < 0.005f ) renderControl->EndCycle(); - mThreadBarrier->wait(); + // End Cycle + mThreadBarrier->wait(); mSumDeltaTime -= initDelta - finalDelta; } @@ -484,7 +502,7 @@ mThreadBarrier->wait(); newCycle = false; - if ( controlNode->GetTime() - mSimTime <= 0.005f ) + if ( controlNode->GetTime() - mSimTime <= 0.005f && !isInputControl) { newCycle = true; controlNode->StartCycle(); Modified: trunk/spark/lib/oxygen/simulationserver/simulationserver.h =================================================================== --- trunk/spark/lib/oxygen/simulationserver/simulationserver.h 2011-02-26 00:09:51 UTC (rev 247) +++ trunk/spark/lib/oxygen/simulationserver/simulationserver.h 2011-03-02 17:22:58 UTC (rev 248) @@ -167,7 +167,7 @@ static void CatchSignal(int sig_num); /** the multi-threaded runloop of the simulation */ - void RunMultiThreaded(); + void RunMultiThreaded(boost::shared_ptr<SimControlNode> &inputCtr); /** the thread function which controls a single SimControlNode in * multi-threaded mode. */ Modified: trunk/spark/plugin/odeimps/odehingejoint.cpp =================================================================== --- trunk/spark/plugin/odeimps/odehingejoint.cpp 2011-02-26 00:09:51 UTC (rev 247) +++ trunk/spark/plugin/odeimps/odehingejoint.cpp 2011-03-02 17:22:58 UTC (rev 248) @@ -32,7 +32,7 @@ { dWorldID ODEWorld = (dWorldID) worldID; dJointID ODEJoint = dJointCreateHinge(ODEWorld, 0); - dJointSetFeedback( ODEJoint, &mFeedback ); + //dJointSetFeedback( ODEJoint, &mFeedback ); return (long) ODEJoint; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <he...@us...> - 2011-03-23 09:57:17
|
Revision: 255 http://simspark.svn.sourceforge.net/simspark/?rev=255&view=rev Author: hedayat Date: 2011-03-23 09:57:11 +0000 (Wed, 23 Mar 2011) Log Message: ----------- Updated Release information Modified Paths: -------------- trunk/spark/ChangeLog trunk/spark/RELEASE Modified: trunk/spark/ChangeLog =================================================================== --- trunk/spark/ChangeLog 2011-03-23 09:12:27 UTC (rev 254) +++ trunk/spark/ChangeLog 2011-03-23 09:57:11 UTC (rev 255) @@ -1,3 +1,8 @@ +2011-03-23 Hedayat Vatankhah <hed...@gm...> + + * RELEASE: + - Updated release information for the next release + 2010-12-15 Yuan Xu <xu...@in...> * plugin/imageperceptor/CMakeLists.txt * plugin/imageperceptor/export.cpp Modified: trunk/spark/RELEASE =================================================================== --- trunk/spark/RELEASE 2011-03-23 09:12:27 UTC (rev 254) +++ trunk/spark/RELEASE 2011-03-23 09:57:11 UTC (rev 255) @@ -1,18 +1,17 @@ -RELEASE News of simspark-0.2.1 +RELEASE News of simspark-0.2.2 -This release of simspark is prepared for RoboCup 2010 competitions in Singapore. -In this release you can find some bug and compilation fixes, improved Windows -support and some new features such as the potential of using different -physical simulation engines. +This release features many small enhancements which will benefit users. +It contains many bug fixes and performance improvements, in addition to +fixing some compilation issues. The behavior of ACC perceptor has been slightly +changed, and the multi-threaded mode should work without any known bugs. +Support for the camera sensor is improved too. More details are as follows: -* New features: - - The core physics system does no longer depend on ODE (Thanks to Andreas). - ODE implementation is now provided as a plugin. - -* Fixes: - - Compilation fixes on newer compilers (VS 2010) - - Fixed some bugs on 64 bit systems and in multi-threaded mode. It is (hopefully) - possible to run multi-threaded games while logging is enabled +- ACC sensor provides raw data without any pre-processing +- Using base64 encoding for camera perceptor +- Fixed bugs in multi-threaded mode. +- Compilation fixes +- HingePerceptor can report torque +- Better Performance You can get the package on the Simspark page on SourceForge at http://sourceforge.net/projects/simspark/ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <he...@us...> - 2011-03-24 16:21:43
|
Revision: 256 http://simspark.svn.sourceforge.net/simspark/?rev=256&view=rev Author: hedayat Date: 2011-03-24 16:21:36 +0000 (Thu, 24 Mar 2011) Log Message: ----------- * Prepared for a new release (updating version numbers) * Added a new timer architecture based on a TimerSystem concept. It is now handled completely separate from SimControlNodes. * Added TimerSystemBoost which is based on Boost timing facilities. Modified Paths: -------------- trunk/spark/CMakeLists.txt trunk/spark/ChangeLog trunk/spark/lib/oxygen/CMakeLists.txt trunk/spark/lib/oxygen/oxygen.cpp trunk/spark/lib/oxygen/oxygen.h trunk/spark/lib/oxygen/simulationserver/simulationserver.cpp trunk/spark/lib/oxygen/simulationserver/simulationserver.h trunk/spark/lib/oxygen/simulationserver/simulationserver_c.cpp trunk/spark/plugin/CMakeLists.txt trunk/spark/spark/spark.rb Added Paths: ----------- trunk/spark/lib/oxygen/simulationserver/timersystem.h trunk/spark/lib/oxygen/simulationserver/timersystem_c.cpp trunk/spark/plugin/timersystemboost/ trunk/spark/plugin/timersystemboost/CMakeLists.txt trunk/spark/plugin/timersystemboost/export.cpp trunk/spark/plugin/timersystemboost/timersystemboost.cpp trunk/spark/plugin/timersystemboost/timersystemboost.h trunk/spark/plugin/timersystemboost/timersystemboost_c.cpp Modified: trunk/spark/CMakeLists.txt =================================================================== --- trunk/spark/CMakeLists.txt 2011-03-23 09:57:11 UTC (rev 255) +++ trunk/spark/CMakeLists.txt 2011-03-24 16:21:36 UTC (rev 256) @@ -1,7 +1,7 @@ cmake_minimum_required(VERSION 2.6) project(simspark CXX C) -set(PACKAGE_VERSION "0.2.1") +set(PACKAGE_VERSION "0.2.2") ########## check for headerfiles/libraries ########## include(CheckIncludeFile) @@ -143,11 +143,11 @@ set(SALT_SO_VERSION 0) set(SALT_VERSION ${SALT_SO_VERSION}.3.2) set(ZEITGEIST_SO_VERSION 3) -set(ZEITGEIST_VERSION ${ZEITGEIST_SO_VERSION}.1.1) -set(OXYGEN_SO_VERSION 4) +set(ZEITGEIST_VERSION ${ZEITGEIST_SO_VERSION}.1.2) +set(OXYGEN_SO_VERSION 5) set(OXYGEN_VERSION ${OXYGEN_SO_VERSION}.0.0) -set(KEROSIN_SO_VERSION 1) -set(KEROSIN_VERSION ${KEROSIN_SO_VERSION}.1.1) +set(KEROSIN_SO_VERSION 2) +set(KEROSIN_VERSION ${KEROSIN_SO_VERSION}.0.0) set(SPARK_SO_VERSION 0) set(SPARK_VERSION ${SPARK_SO_VERSION}.0.1) set(RCSSNET_SO_VERSION 0) Modified: trunk/spark/ChangeLog =================================================================== --- trunk/spark/ChangeLog 2011-03-23 09:57:11 UTC (rev 255) +++ trunk/spark/ChangeLog 2011-03-24 16:21:36 UTC (rev 256) @@ -1,3 +1,42 @@ +2011-03-24 Hedayat Vatankhah <hed...@gm...> + + * plugin/timersystemboost/timersystemboost.h: + * plugin/timersystemboost/timersystemboost.cpp: + * plugin/timersystemboost/timersystemboost_c.cpp: + * plugin/timersystemboost/export.cpp: + * plugin/timersystemboost/CMakeLists.txt: + - Added TimerSystemBoost which uses Boost facilities for timing + + * plugin/CMakeLists.txt: + - Added timersystemboost to the list of plugins + - Reordering the list of plugins to make it sorted again + + * CMakeLists.txt: + - Prepare for 0.2.2 release: changed the version number and update library + versions + + * spark/spark.rb: + - Disable old style timer and add sparkSetupTimer() function for + setting up a timer system + + * lib/oxygen/simulationserver/simulationserver.h: + * lib/oxygen/simulationserver/simulationserver.cpp: + * lib/oxygen/simulationserver/simulationserver_c.cpp: + - Use TimerSystem for timing + - Added InitTimerSystem() to setup a timer system for simulation server + - Fixed a few spelling errors + - Added SyncTime() method which is responsible for updating mSumDeltaTime + using a TimerSystem or simulator's internal clock. + - Using Step() in multi-threaded mode in addition to the single threaded + mode. Looks like that there is no need to differentiate any more. + + * lib/oxygen/oxygen.cpp: + * lib/oxygen/oxygen.h: + * lib/oxygen/CMakeLists.txt: + * lib/oxygen/simulationserver/timersystem.h: + * lib/oxygen/simulationserver/timersystem_c.cpp: + - Added a new TimerSystem mechanism to control simulator timing + 2011-03-23 Hedayat Vatankhah <hed...@gm...> * RELEASE: Modified: trunk/spark/lib/oxygen/CMakeLists.txt =================================================================== --- trunk/spark/lib/oxygen/CMakeLists.txt 2011-03-23 09:57:11 UTC (rev 255) +++ trunk/spark/lib/oxygen/CMakeLists.txt 2011-03-24 16:21:36 UTC (rev 256) @@ -110,6 +110,7 @@ simulationserver/netmessage.h simulationserver/netbuffer.h simulationserver/traincontrol.h + simulationserver/timersystem.h geometryserver/geometryserver.h geometryserver/meshexporter.h geometryserver/meshimporter.h @@ -260,6 +261,7 @@ simulationserver/netbuffer.cpp simulationserver/traincontrol.cpp simulationserver/traincontrol_c.cpp + simulationserver/timersystem_c.cpp geometryserver/geometryserver.h geometryserver/geometryserver.cpp geometryserver/geometryserver_c.cpp Modified: trunk/spark/lib/oxygen/oxygen.cpp =================================================================== --- trunk/spark/lib/oxygen/oxygen.cpp 2011-03-23 09:57:11 UTC (rev 255) +++ trunk/spark/lib/oxygen/oxygen.cpp 2011-03-24 16:21:36 UTC (rev 256) @@ -44,6 +44,7 @@ zg.GetCore()->RegisterClassObject(new CLASS(MonitorControl), "oxygen/"); zg.GetCore()->RegisterClassObject(new CLASS(MonitorLogger), "oxygen/"); zg.GetCore()->RegisterClassObject(new CLASS(TrainControl), "oxygen/"); + zg.GetCore()->RegisterClassObject(new CLASS(TimerSystem), "oxygen/"); // geometry zg.GetCore()->RegisterClassObject(new CLASS(GeometryServer), "oxygen/"); Modified: trunk/spark/lib/oxygen/oxygen.h =================================================================== --- trunk/spark/lib/oxygen/oxygen.h 2011-03-23 09:57:11 UTC (rev 255) +++ trunk/spark/lib/oxygen/oxygen.h 2011-03-24 16:21:36 UTC (rev 256) @@ -90,6 +90,7 @@ #include <oxygen/simulationserver/monitorcontrol.h> #include <oxygen/simulationserver/monitorlogger.h> #include <oxygen/simulationserver/traincontrol.h> +#include <oxygen/simulationserver/timersystem.h> #include <oxygen/geometryserver/geometryserver.h> #include <oxygen/geometryserver/meshexporter.h> Modified: trunk/spark/lib/oxygen/simulationserver/simulationserver.cpp =================================================================== --- trunk/spark/lib/oxygen/simulationserver/simulationserver.cpp 2011-03-23 09:57:11 UTC (rev 255) +++ trunk/spark/lib/oxygen/simulationserver/simulationserver.cpp 2011-03-24 16:21:36 UTC (rev 256) @@ -21,6 +21,7 @@ */ #include "simulationserver.h" #include "simcontrolnode.h" +#include "timersystem.h" #include <zeitgeist/logserver/logserver.h> #include <signal.h> #include <algorithm> @@ -183,6 +184,33 @@ return true; } +/** creates and registers a new TimerSystem to the SimulationServer */ +bool SimulationServer::InitTimerSystem(const std::string& className) +{ + if (mTimerSystem) + { + GetLog()->Error() << "(SimulationServer) ERROR: " + << "Another timer system already in use!\n"; + return false; + } + + mTimerSystem = shared_dynamic_cast<TimerSystem>(GetCore()->New(className)); + SetAutoTimeMode(false); + + if (!mTimerSystem) + { + GetLog()->Error() << "(SimulationServer) ERROR: " + << "Unable to create '" << className << "'\n"; + return false; + } + + GetLog()->Normal() + << "(SimulationServer) TimerSystem '" + << className << "' registered\n"; + + return true; +} + boost::shared_ptr<SimControlNode> SimulationServer::GetControlNode(const string& controlName) { @@ -237,7 +265,6 @@ mSimTime += mSumDeltaTime; mSumDeltaTime = 0; } -// usleep(10000); } void SimulationServer::ControlEvent(EControlEvent event) @@ -305,6 +332,11 @@ mArgV = argv; ControlEvent(CE_Init); + + if (mTimerSystem) + { + mTimerSystem->Initialize(); + } } void SimulationServer::Run(int argc, char** argv) @@ -312,25 +344,26 @@ Init(argc, argv); GetLog()->Normal() << "(SimulationServer) entering runloop\n"; - boost::shared_ptr<SimControlNode> inputCtr = GetControlNode("InputControl"); - - if ( mMultiThreads ) + if ( !mAutoTime && !mTimerSystem ) { - GetLog()->Normal()<< "(SimulationServer) running in multi-threads\n"; - RunMultiThreaded(inputCtr); + GetLog()->Error()<< "(SimulationServer) ERROR: can not get" + " any TimerSystem objects.\n"; } else { - GetLog()->Normal()<< "(SimulationServer) running in single thread\n"; - if ( !mAutoTime && inputCtr.get() == 0 ) + if ( mMultiThreads ) { - GetLog()->Error()<< "(SimulationServer) ERROR: can not get InputControl\n"; + GetLog()->Normal()<< "(SimulationServer) running in " + "multi-threaded mode\n"; + RunMultiThreaded(); } else { + GetLog()->Normal()<< "(SimulationServer) running in single " + "thread mode\n"; while (! mExit) { - Cycle(inputCtr); + Cycle(); } } } @@ -338,7 +371,7 @@ Done(); } -void SimulationServer::Cycle(boost::shared_ptr<SimControlNode> &inputCtr) +void SimulationServer::Cycle() { ++mCycle; @@ -347,26 +380,18 @@ ControlEvent(CE_ActAgent); Step(); - if (mAutoTime) - { - AdvanceTime(mSimStep); - } - else - { - if (inputCtr.get() != 0) - { - while (int(mSumDeltaTime*100) < int(mSimStep*100)) - { - inputCtr->StartCycle();// advance the time - } - } - } + SyncTime(); ControlEvent(CE_EndCycle); } void SimulationServer::Done() { + if (mTimerSystem) + { + mTimerSystem->Finalize(); + } + ControlEvent(CE_Done); mArgC = 0; @@ -392,17 +417,8 @@ return mSceneServer.get(); } -void SimulationServer::RunMultiThreaded(boost::shared_ptr<SimControlNode> &inputCtr) +void SimulationServer::RunMultiThreaded() { - if (mSimStep == 0) - { - GetLog()->Error() << "(SimulationServer) ERROR: multi-threaded " - << "mode supports descreet simulations only.\n"; - return; - } - - boost::thread_group ctrThrdGroup; - // count valid SimControlNodes. int count = 1; for ( TLeafList::iterator iter=begin(); iter != end(); ++iter ) @@ -413,6 +429,7 @@ mThreadBarrier = new barrier(count); // create new threads for each SimControlNode + boost::thread_group ctrThrdGroup; for ( TLeafList::iterator iter=begin(); iter != end(); ++iter ) { boost::shared_ptr<SimControlNode> ctrNode = shared_dynamic_cast<SimControlNode>(*iter); @@ -433,51 +450,19 @@ mThreadBarrier->wait(); if (mExit) mExitThreads = true; - - // Wait for SimControlNodes' acts at the begining of a cycle + + // Wait for SimControlNodes' acts at the beginning of a cycle mThreadBarrier->wait(); - finalDelta = initDelta = mSumDeltaTime; + Step(); + SyncTime(); - mSceneServer->PrePhysicsUpdate(mSimStep); - mSceneServer->PhysicsUpdate(mSimStep); - - if (mAutoTime) - { - AdvanceTime(mSimStep); - } - - else - { - if (inputCtr.get() != 0) - { - while (int(mSumDeltaTime*100) < int(mSimStep*100)) - { - inputCtr->StartCycle();// advance the time - } - } - } - - UpdateDeltaTimeAfterStep(finalDelta); - - float finalStep = mSimStep; - while (int(finalDelta*100) >= int(mSimStep*100)) - { - mSceneServer->PhysicsUpdate(mSimStep); - UpdateDeltaTimeAfterStep(finalDelta); - finalStep += mSimStep; - } - mSceneServer->PostPhysicsUpdate(); - mGameControlServer->Update(finalStep); - mSimTime += finalStep; - if (renderControl && renderControl->GetTime() - mSimTime < 0.005f ) renderControl->EndCycle(); // End Cycle - mThreadBarrier->wait(); - mSumDeltaTime -= initDelta - finalDelta; + mThreadBarrier->wait(); } // wait for threads @@ -493,16 +478,15 @@ return; } - bool isInputControl = (controlNode->GetName() == "InputControl"); bool isRenderControl = (controlNode->GetName() == "RenderControl"); bool newCycle = false; while (!mExitThreads) { mThreadBarrier->wait(); - + newCycle = false; - if ( controlNode->GetTime() - mSimTime <= 0.005f && !isInputControl) + if ( controlNode->GetTime() - mSimTime <= 0.005f) { newCycle = true; controlNode->StartCycle(); @@ -552,3 +536,16 @@ else deltaTime -= mSimStep; } + +inline void SimulationServer::SyncTime() +{ + if (mAutoTime) + { + AdvanceTime(mSimStep); + } + else + { + mTimerSystem->WaitFromLastQueryUntil(mSimStep - mSumDeltaTime); + AdvanceTime(mTimerSystem->GetTimeSinceLastQuery()); + } +} Modified: trunk/spark/lib/oxygen/simulationserver/simulationserver.h =================================================================== --- trunk/spark/lib/oxygen/simulationserver/simulationserver.h 2011-03-23 09:57:11 UTC (rev 255) +++ trunk/spark/lib/oxygen/simulationserver/simulationserver.h 2011-03-24 16:21:36 UTC (rev 256) @@ -32,6 +32,7 @@ namespace oxygen { class SimControlNode; +class TimerSystem; class OXYGEN_API SimulationServer : public zeitgeist::Node { @@ -90,6 +91,10 @@ SimulationServer */ bool InitControlNode(const std::string& className, const std::string& name); + /** creates a new TimerSystem of type \param className to be used as + * the simulator's internal timer */ + bool InitTimerSystem(const std::string& className); + /** sets the auto time mode of the SimulationServer. if set to true the SimulationServer automatically advances the simulation mSimStep time every cycle, this is the default @@ -114,8 +119,9 @@ /** init the runloop and all registered control nodes */ virtual void Init(int argc = 0, char** argv = 0); - /** go through on cycle of the runloop, i.e. sense, act, step */ - virtual void Cycle(boost::shared_ptr<SimControlNode> &inputCtr); + /** go through on cycle of the runloop (single threaded mode), i.e. sense, + * act, step */ + virtual void Cycle(); /** shutdown server and all registered control nodes */ virtual void Done(); @@ -131,7 +137,7 @@ /** returns the cached GameControlServer reference */ boost::shared_ptr<GameControlServer> GetGameControlServer(); - /** returns thr cached SceneServer reference */ + /** returns the cached SceneServer reference */ boost::shared_ptr<SceneServer> GetSceneServer(); /** returns the current simulation cycle */ @@ -167,15 +173,20 @@ static void CatchSignal(int sig_num); /** the multi-threaded runloop of the simulation */ - void RunMultiThreaded(boost::shared_ptr<SimControlNode> &inputCtr); + void RunMultiThreaded(); /** the thread function which controls a single SimControlNode in * multi-threaded mode. */ void SimControlThread(boost::shared_ptr<SimControlNode> controlNode); - /** updates mSumDeltaTime after a step in descreet simulations */ + /** updates mSumDeltaTime after a step in discreet simulations */ void UpdateDeltaTimeAfterStep(float &deltaTime); + /** updates the accumulated time since last simulation step using the + * specified timing method: it might use simulator's own clock (if mAutoTime + * is true) or a TimerSystem provided using InitTimerSystem() */ + void SyncTime(); + protected: /** the argc parameter passed to Run() */ int mArgC; @@ -230,6 +241,9 @@ /** barrier object for synchronizing threads in multi-threaded mode */ boost::barrier *mThreadBarrier; + + /** the timer system to control the simulation */ + boost::shared_ptr<TimerSystem> mTimerSystem; }; DECLARE_CLASS(SimulationServer); Modified: trunk/spark/lib/oxygen/simulationserver/simulationserver_c.cpp =================================================================== --- trunk/spark/lib/oxygen/simulationserver/simulationserver_c.cpp 2011-03-23 09:57:11 UTC (rev 255) +++ trunk/spark/lib/oxygen/simulationserver/simulationserver_c.cpp 2011-03-24 16:21:36 UTC (rev 256) @@ -45,10 +45,24 @@ return false; } - return obj->InitControlNode(inClassName,inName); + return obj->InitControlNode(inClassName, inName); } +FUNCTION(SimulationServer,initTimerSystem) +{ + string inClassName; + if ( + (in.GetSize() != 1) || + (! in.GetValue(in[0],inClassName)) + ) + { + return false; + } + + return obj->InitTimerSystem(inClassName); +} + FUNCTION(SimulationServer, getTime) { return obj->GetTime(); @@ -156,6 +170,7 @@ DEFINE_BASECLASS(zeitgeist/Node); DEFINE_FUNCTION(quit); DEFINE_FUNCTION(initControlNode); + DEFINE_FUNCTION(initTimerSystem); DEFINE_FUNCTION(getTime); DEFINE_FUNCTION(resetTime); DEFINE_FUNCTION(setSimStep); Added: trunk/spark/lib/oxygen/simulationserver/timersystem.h =================================================================== --- trunk/spark/lib/oxygen/simulationserver/timersystem.h (rev 0) +++ trunk/spark/lib/oxygen/simulationserver/timersystem.h 2011-03-24 16:21:36 UTC (rev 256) @@ -0,0 +1,59 @@ +/* -*- mode: c++; c-basic-offset: 4; indent-tabs-mode: nil -*- + + This file is part of rcssserver3D + Thu Mar 24 2011 + Copyright (C) 2003-1011 RoboCup Soccer Server 3D Maintenance Group + $Id$ + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; version 2 of the License. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +*/ +#ifndef OXYGEN_TIMERSYSTEM_H +#define OXYGEN_TIMERSYSTEM_H + +#include <zeitgeist/class.h> +#include <zeitgeist/leaf.h> + +namespace oxygen +{ +/** \class TimerSystem defines the interface for an external timer to control + * the simulation. + */ +class TimerSystem: public zeitgeist::Leaf +{ +public: + /** initialize the timer system. It is called once at the beginning of a + * simulation. + */ + virtual void Initialize() = 0; + + /** \return the elapsed time since the last call of this function or since + * the initialization for the first call. + */ + virtual float GetTimeSinceLastQuery() = 0; + + /** waits until \param deadline seconds is passed since the last call to + * GetTimeSinceLastQuery(). If that is already passed, it'll return + * immediately. + */ + virtual void WaitFromLastQueryUntil(float deadline) = 0; + + /** this is called at the end of the simulation */ + virtual void Finalize() {} +}; + +DECLARE_ABSTRACTCLASS(TimerSystem); + +} // namespace oxygen + +#endif // OXYGEN_TIMERSYSTEM_H Added: trunk/spark/lib/oxygen/simulationserver/timersystem_c.cpp =================================================================== --- trunk/spark/lib/oxygen/simulationserver/timersystem_c.cpp (rev 0) +++ trunk/spark/lib/oxygen/simulationserver/timersystem_c.cpp 2011-03-24 16:21:36 UTC (rev 256) @@ -0,0 +1,28 @@ +/* -*- mode: c++; c-basic-offset: 4; indent-tabs-mode: nil -*- + + This file is part of rcssserver3D + Thu Mar 24 2011 + Copyright (C) 2003-1011 RoboCup Soccer Server 3D Maintenance Group + $Id$ + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; version 2 of the License. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +*/ +#include "timersystem.h" + +using namespace oxygen; + +void CLASS(TimerSystem)::DefineClass() +{ + DEFINE_BASECLASS(zeitgeist/Leaf); +} Modified: trunk/spark/plugin/CMakeLists.txt =================================================================== --- trunk/spark/plugin/CMakeLists.txt 2011-03-23 09:57:11 UTC (rev 255) +++ trunk/spark/plugin/CMakeLists.txt 2011-03-24 16:21:36 UTC (rev 256) @@ -11,25 +11,26 @@ add_subdirectory(accelerometer) add_subdirectory(agentsynceffector) +add_subdirectory(collisionperceptor) add_subdirectory(filesystemstd) add_subdirectory(filesystemzip) add_subdirectory(forceeffector) add_subdirectory(gyrorateperceptor) add_subdirectory(inputsdl) +add_subdirectory(inputwx) add_subdirectory(objimporter) add_subdirectory(odeimps) add_subdirectory(openglsyssdl) +add_subdirectory(openglsyswx) add_subdirectory(perfectvisionperceptor) -add_subdirectory(collisionperceptor) -add_subdirectory(sexpparser) add_subdirectory(rosimporter) add_subdirectory(rubysceneimporter) +add_subdirectory(sexpparser) add_subdirectory(sparkmonitor) add_subdirectory(sparkagent) add_subdirectory(sceneeffector) add_subdirectory(soundsystemfmod) -add_subdirectory(inputwx) -add_subdirectory(openglsyswx) +add_subdirectory(timersystemboost) if (APPLE) if (DEVEL) add_subdirectory(imageperceptor) Added: trunk/spark/plugin/timersystemboost/CMakeLists.txt =================================================================== --- trunk/spark/plugin/timersystemboost/CMakeLists.txt (rev 0) +++ trunk/spark/plugin/timersystemboost/CMakeLists.txt 2011-03-24 16:21:36 UTC (rev 256) @@ -0,0 +1,18 @@ +########### next target ############### + +set(timersystemboost_LIB_SRCS + export.cpp + timersystemboost.cpp + timersystemboost_c.cpp + timersystemboost.h +) + +add_library(timersystemboost MODULE ${timersystemboost_LIB_SRCS}) + +target_link_libraries(timersystemboost ${spark_libs}) + +if (NOT APPLE) + set_target_properties(timersystemboost PROPERTIES VERSION 0.0.0 SOVERSION 0) +endif (NOT APPLE) + +install(TARGETS timersystemboost DESTINATION ${LIBDIR}/${CMAKE_PROJECT_NAME}) Added: trunk/spark/plugin/timersystemboost/export.cpp =================================================================== --- trunk/spark/plugin/timersystemboost/export.cpp (rev 0) +++ trunk/spark/plugin/timersystemboost/export.cpp 2011-03-24 16:21:36 UTC (rev 256) @@ -0,0 +1,27 @@ +/* -*- mode: c++; c-basic-offset: 4; indent-tabs-mode: nil -*- + + This file is part of rcssserver3D + Thu Mar 24 2011 + Copyright (C) 2003-1011 RoboCup Soccer Server 3D Maintenance Group + $Id$ + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; version 2 of the License. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +*/ +#include "timersystemboost.h" +#include <zeitgeist/zeitgeist.h> + + using namespace oxygen; +ZEITGEIST_EXPORT_BEGIN() + ZEITGEIST_EXPORT(TimerSystemBoost); +ZEITGEIST_EXPORT_END() Added: trunk/spark/plugin/timersystemboost/timersystemboost.cpp =================================================================== --- trunk/spark/plugin/timersystemboost/timersystemboost.cpp (rev 0) +++ trunk/spark/plugin/timersystemboost/timersystemboost.cpp 2011-03-24 16:21:36 UTC (rev 256) @@ -0,0 +1,52 @@ +/* -*- mode: c++; c-basic-offset: 4; indent-tabs-mode: nil -*- + + This file is part of rcssserver3D + Thu Mar 24 2011 + Copyright (C) 2003-1011 RoboCup Soccer Server 3D Maintenance Group + $Id$ + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; version 2 of the License. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +*/ +#include "timersystemboost.h" +#include <boost/date_time/posix_time/posix_time.hpp> +#include <zeitgeist/logserver/logserver.h> + +using namespace oxygen; + +void TimerSystemBoost::Initialize() +{ + mLastQueryTime = boost::get_system_time(); +} + +float TimerSystemBoost::GetTimeSinceLastQuery() +{ + boost::system_time currentTime = boost::get_system_time(); + boost::posix_time::time_duration timeDiff = currentTime - mLastQueryTime; + mLastQueryTime = currentTime; + return timeDiff.total_milliseconds() / 1000.0f; +} + +void TimerSystemBoost::WaitFromLastQueryUntil(float deadline) +{ + int milliseconds = round(deadline * 1000); +// GetLog()->Debug() << "(TimerSystemBoost) Waiting for " << deadline +// << " seconds or " << milliseconds << " millisecs\n"; + boost::thread::sleep(mLastQueryTime + + boost::posix_time::milliseconds(milliseconds)); +// GetLog()->Debug() << "CURRENT TIME: " << boost::get_system_time() << '\n'; +} + +//void TimerSystemBoost::Finalize() +//{ +//} Added: trunk/spark/plugin/timersystemboost/timersystemboost.h =================================================================== --- trunk/spark/plugin/timersystemboost/timersystemboost.h (rev 0) +++ trunk/spark/plugin/timersystemboost/timersystemboost.h 2011-03-24 16:21:36 UTC (rev 256) @@ -0,0 +1,62 @@ +/* -*- mode: c++; c-basic-offset: 4; indent-tabs-mode: nil -*- + + This file is part of rcssserver3D + Thu Mar 24 2011 + Copyright (C) 2003-1011 RoboCup Soccer Server 3D Maintenance Group + $Id$ + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; version 2 of the License. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +*/ +#ifndef OXYGEN_BOOSTTIMERSYSTEM_H +#define OXYGEN_BOOSTTIMERSYSTEM_H + +#include <boost/thread/thread.hpp> +#include <oxygen/simulationserver/timersystem.h> + +namespace oxygen +{ +/** \class TimerSystemBoost is a timer system based on Boost timing facilities + */ +class TimerSystemBoost: public TimerSystem +{ +public: + /** initialize the timer system. It is called once at the beginning of a + * simulation. + */ + virtual void Initialize(); + + /** \return the elapsed time since the last call of this function or since + * the initialization for the first call. + */ + virtual float GetTimeSinceLastQuery(); + + /** waits until \param deadline seconds is passed since the last call to + * GetTimeSinceLastQuery(). If that is already passed, it'll return + * immediately. + */ + virtual void WaitFromLastQueryUntil(float deadline); + + /** this is called at the end of the simulation */ + virtual void Finalize() {} + +private: + /** the last time GetTimeSinceLastQuery is called or zero on Initialize() */ + boost::system_time mLastQueryTime; +}; + +DECLARE_CLASS(TimerSystemBoost); + +} // namespace oxygen + +#endif // OXYGEN_BOOSTTIMERSYSTEM_H Added: trunk/spark/plugin/timersystemboost/timersystemboost_c.cpp =================================================================== --- trunk/spark/plugin/timersystemboost/timersystemboost_c.cpp (rev 0) +++ trunk/spark/plugin/timersystemboost/timersystemboost_c.cpp 2011-03-24 16:21:36 UTC (rev 256) @@ -0,0 +1,28 @@ +/* -*- mode: c++; c-basic-offset: 4; indent-tabs-mode: nil -*- + + This file is part of rcssserver3D + Thu Mar 24 2011 + Copyright (C) 2003-1011 RoboCup Soccer Server 3D Maintenance Group + $Id$ + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; version 2 of the License. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +*/ +#include "timersystemboost.h" + +using namespace oxygen; + +void CLASS(TimerSystemBoost)::DefineClass() +{ + DEFINE_BASECLASS(oxygen/TimerSystem); +} Modified: trunk/spark/spark/spark.rb =================================================================== --- trunk/spark/spark/spark.rb 2011-03-23 09:57:11 UTC (rev 255) +++ trunk/spark/spark/spark.rb 2011-03-24 16:21:36 UTC (rev 256) @@ -10,7 +10,7 @@ $scenePath = '/usr/scene/' $serverPath = '/sys/server/' -# (Inputsystem) +# (Input system) # # the default InputSystem used to read keyboard, mouse and timer input @@ -19,9 +19,15 @@ # the name of the default bundle that contains the default InputSystem $defaultInputSystemBundle = 'inputsdl' -# if simulator should run in real time rather than simulation time -$useRealTime = true +# (Timer system) +# +# the default TimerSystem used to control the simulation timing +$defaultTimerSystem = 'TimerSystemBoost' + +# the name of the default bundle that contains the default TimerSystem +$defaultTimerSystemBundle = 'timersystemboost' + # (OpenGL rendering) # @@ -394,7 +400,7 @@ inputServer.init(inputSystem) # add devices - inputServer.createDevice('Timer') + #inputServer.createDevice('Timer') inputServer.createDevice('Keyboard') inputServer.createDevice('Mouse') end @@ -411,10 +417,27 @@ # set timing mode (real time vs simulation time) inputControl = get($serverPath+'simulation/InputControl') if (inputControl != nil) - inputControl.setAdvanceTime($useRealTime) + inputControl.setAdvanceTime(false) end end +def sparkSetupTimer(timerSystem = $defaultTimerSystem) + print "(spark.rb) sparkSetupTimer\n" + print "(spark.rb) using TimerSystem '" + timerSystem + "'\n" + + # setup the Boost timer system + if (timerSystem == $defaultTimerSystem) + importBundle($defaultTimerSystemBundle) + end + + # + # register timer system to the simulation server + simulationServer = sparkGetSimulationServer() + if (simulationServer != nil) + simulationServer.initTimerSystem(timerSystem) + end +end + def sparkSetupTrain() #print "(spark.rb) sparkSetupTrain\n" # This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <he...@us...> - 2011-03-24 18:08:56
|
Revision: 258 http://simspark.svn.sourceforge.net/simspark/?rev=258&view=rev Author: hedayat Date: 2011-03-24 18:08:49 +0000 (Thu, 24 Mar 2011) Log Message: ----------- Removing our own FindDevIL and relying on CMake's own module Modified Paths: -------------- trunk/spark/CMakeLists.txt trunk/spark/ChangeLog trunk/spark/lib/kerosin/CMakeLists.txt trunk/spark/spark/CMakeLists.txt trunk/spark/test/fonttest/CMakeLists.txt trunk/spark/test/inputtest/CMakeLists.txt trunk/spark/test/scenetest/CMakeLists.txt Removed Paths: ------------- trunk/spark/cmake/FindDevIL.cmake Modified: trunk/spark/CMakeLists.txt =================================================================== --- trunk/spark/CMakeLists.txt 2011-03-24 16:29:33 UTC (rev 257) +++ trunk/spark/CMakeLists.txt 2011-03-24 18:08:49 UTC (rev 258) @@ -201,7 +201,7 @@ install(DIRECTORY "${Boost_LIBRARY_DIRS}/" DESTINATION ${THLIBDIR} FILES_MATCHING PATTERN "*.dll") - string(REGEX REPLACE "(.*)\\.lib" "\\1.dll" DevIL_DLL "${DevIL_LIBRARY_IL}") + string(REGEX REPLACE "(.*)\\.lib" "\\1.dll" DevIL_DLL "${IL_LIBRARIES}") if (EXISTS ${DevIL_DLL}) install(PROGRAMS ${DevIL_DLL} DESTINATION ${THLIBDIR}) endif (EXISTS ${DevIL_DLL}) Modified: trunk/spark/ChangeLog =================================================================== --- trunk/spark/ChangeLog 2011-03-24 16:29:33 UTC (rev 257) +++ trunk/spark/ChangeLog 2011-03-24 18:08:49 UTC (rev 258) @@ -1,5 +1,12 @@ 2011-03-24 Hedayat Vatankhah <hed...@gm...> + * spark/CMakeLists.txt: + * lib/kerosin/CMakeLists.txt: + * test/fonttest/CMakeLists.txt: + * test/inputtest/CMakeLists.txt: + * test/scenetest/CMakeLists.txt: + - fixed to use CMake's own FindDevIL module + * plugin/timersystemboost/timersystemboost.h: * plugin/timersystemboost/timersystemboost.cpp: * plugin/timersystemboost/timersystemboost_c.cpp: Deleted: trunk/spark/cmake/FindDevIL.cmake =================================================================== --- trunk/spark/cmake/FindDevIL.cmake 2011-03-24 16:29:33 UTC (rev 257) +++ trunk/spark/cmake/FindDevIL.cmake 2011-03-24 18:08:49 UTC (rev 258) @@ -1,124 +0,0 @@ -# -Try to find DevIL (developer image) library -# formerly known as OpenIL, see -# http://openil.sourceforge.net -# -# Once run this will define: -# -# DevIL_FOUND -# DevIL_INCLUDE_DIR -# DevIL_LIBRARIES -# -# Jan Woetzel 12/2005. -# -# www.mip.informatik.uni-kiel.de/~jw -# -------------------------------- - -# base dirs: -SET(DevIL_POSSIBLE_ROOT_PATHS - ${DevIL_ROOT_DIR} - $ENV{DevIL_ROOT_DIR} - ${DevIL_DIR} - $ENV{DevIL_DIR} - ${DEVIL_DIR} - $ENV{DEVIL_DIR} - ${DEVIL_HOME} - $ENV{DEVIL_HOME} - "$ENV{EXTERN_LIBS_DIR}/DevIL" - $ENV{EXTRA_DIR} - $ENV{EXTRA} - $ENV{ProgramFiles}/DevIL - /usr/local/ - /usr/ - /opt/net/gcc41/DevIL - /opt/net/gcc33/DevIL - C:/library/DevIL - "C:/Program Files/DevIL" - "C:/Program Files (x86)/DevIL" - C:/DevIL - ) - -# appended -SET(DevIL_POSSIBLE_INCDIR_SUFFIXES - include - DevIL/include ) -SET(DevIL_POSSIBLE_LIBDIR_SUFFIXES - lib - lib64 - ) - - - -FIND_PATH(DevIL_INCLUDE_DIR - NAMES IL/il.h - PATHS ${DevIL_POSSIBLE_ROOT_PATHS} - PATH_SUFFIXES ${DevIL_POSSIBLE_INCDIR_SUFFIXES} ) -#MESSAGE("DBG DevIL_INCLUDE_DIR=${DevIL_INCLUDE_DIR}") - - -FIND_LIBRARY(DevIL_LIBRARY_IL - NAMES DevIL devil DevIL IL - PATHS ${DevIL_POSSIBLE_ROOT_PATHS} - PATH_SUFFIXES ${DevIL_POSSIBLE_LIBDIR_SUFFIXES} ) -#MESSAGE("DBG DevIL_LIBRARY_IL=${DevIL_LIBRARY_IL}") - -FIND_LIBRARY(DevIL_LIBRARY_ILU - NAMES ILU ilu Ilu - PATHS ${DevIL_POSSIBLE_ROOT_PATHS} - PATH_SUFFIXES ${DevIL_POSSIBLE_LIBDIR_SUFFIXES} ) -#MESSAGE("DBG DevIL_LIBRARY_ILU=${DevIL_LIBRARY_ILU}") - -FIND_LIBRARY(DevIL_LIBRARY_ILUT - NAMES ILUT ilu Ilut - PATHS ${DevIL_POSSIBLE_ROOT_PATHS} - PATH_SUFFIXES ${DevIL_POSSIBLE_LIBDIR_SUFFIXES} ) -#MESSAGE("DBG DevIL_LIBRARY_ILUT=${DevIL_LIBRARY_ILUT}") - - - -# -------------------------------- - -IF (DevIL_INCLUDE_DIR) - IF (DevIL_LIBRARY_IL) - IF (DevIL_LIBRARY_ILU)# AND DevIL_LIBRARY_ILUT) - - SET(DevIL_FOUND TRUE) - SET(DevIL_LIBRARIES - ${DevIL_LIBRARY_IL} - ${DevIL_LIBRARY_ILU}) - IF (DevIL_LIBRARY_ILUT) - SET(DevIL_LIBRARIES ${DevIL_LIBRARIES} ${DevIL_LIBRARY_ILUT}) - ENDIF (DevIL_LIBRARY_ILUT) - - # get the link directory for rpath to be used with LINK_DIRECTORIES: - GET_FILENAME_COMPONENT(DevIL_LINK_DIRECTORIES ${DevIL_LIBRARY_IL} PATH) - - ENDIF(DevIL_LIBRARY_ILU)# AND DevIL_LIBRARY_ILUT) - ENDIF(DevIL_LIBRARY_IL) -ENDIF (DevIL_INCLUDE_DIR) - - -MARK_AS_ADVANCED( - DevIL_INCLUDE_DIR - DevIL_LIBRARY_IL - DevIL_LIBRARY_ILU - DevIL_LIBRARY_ILUT - DevIL_LIBRARIES - ) - - -# ========================================== -IF(NOT DevIL_FOUND) - # make FIND_PACKAGE friendly - IF(NOT DevIL_FIND_QUIETLY) - IF(DevIL_FIND_REQUIRED) - MESSAGE(FATAL_ERROR "DevIL required, please specify it's location.") - ELSE(DevIL_FIND_REQUIRED) - MESSAGE(STATUS "ERROR: DevIL was not found.") - ENDIF(DevIL_FIND_REQUIRED) - ENDIF(NOT DevIL_FIND_QUIETLY) -ENDIF(NOT DevIL_FOUND) - -# backward compatibility -SET(DEVIL_FOUND ${DevIL_FOUND}) -SET(DEVIL_LIBRARIES ${DevIL_LIBRARIES}) -SET(DEVIL_INCLUDE_DIR ${DevIL_INCLUDE_DIR}) Modified: trunk/spark/lib/kerosin/CMakeLists.txt =================================================================== --- trunk/spark/lib/kerosin/CMakeLists.txt 2011-03-24 16:29:33 UTC (rev 257) +++ trunk/spark/lib/kerosin/CMakeLists.txt 2011-03-24 18:08:49 UTC (rev 258) @@ -118,11 +118,11 @@ ) include_directories(${CMAKE_SOURCE_DIR}/lib ${FREETYPE_INCLUDE_DIRS} - ${DevIL_INCLUDE_DIR} ${SDL_INCLUDE_DIR} ${OPENGL_INCLUDE_DIR}) + ${IL_INCLUDE_DIR} ${SDL_INCLUDE_DIR} ${OPENGL_INCLUDE_DIR}) add_library(kerosin ${kerosin_LIB_SRCS} ${kerosin_LIB_HDRS}) -target_link_libraries(kerosin ${FREETYPE_LIBRARIES} ${DevIL_LIBRARIES} +target_link_libraries(kerosin ${FREETYPE_LIBRARIES} ${IL_LIBRARIES} ${SDL_LIBRARY} ${OPENGL_LIBRARIES} ${kerosin_require_libs}) set_target_properties(kerosin PROPERTIES VERSION ${KEROSIN_VERSION} Modified: trunk/spark/spark/CMakeLists.txt =================================================================== --- trunk/spark/spark/CMakeLists.txt 2011-03-24 16:29:33 UTC (rev 257) +++ trunk/spark/spark/CMakeLists.txt 2011-03-24 18:08:49 UTC (rev 258) @@ -6,7 +6,7 @@ ) include_directories(${CMAKE_SOURCE_DIR}/lib ${CMAKE_SOURCE_DIR}/utility ${FREETYPE_INCLUDE_DIRS} - ${DevIL_INCLUDE_DIR}) + ${IL_INCLUDE_DIR}) add_library(spark ${spark_LIB_SRCS}) Modified: trunk/spark/test/fonttest/CMakeLists.txt =================================================================== --- trunk/spark/test/fonttest/CMakeLists.txt 2011-03-24 16:29:33 UTC (rev 257) +++ trunk/spark/test/fonttest/CMakeLists.txt 2011-03-24 18:08:49 UTC (rev 258) @@ -6,7 +6,7 @@ ) include_directories(${SDL_INCLUDE_DIR} ${FREETYPE_INCLUDE_DIRS} - ${DevIL_INCLUDE_DIR}) + ${IL_INCLUDE_DIR}) add_executable(fonttest ${fonttest_SRCS}) Modified: trunk/spark/test/inputtest/CMakeLists.txt =================================================================== --- trunk/spark/test/inputtest/CMakeLists.txt 2011-03-24 16:29:33 UTC (rev 257) +++ trunk/spark/test/inputtest/CMakeLists.txt 2011-03-24 18:08:49 UTC (rev 258) @@ -6,7 +6,7 @@ ) include_directories(${SDL_INCLUDE_DIR} ${FREETYPE_INCLUDE_DIRS} - ${DevIL_INCLUDE_DIR}) + ${IL_INCLUDE_DIR}) add_executable(inputtest ${inputtest_SRCS}) Modified: trunk/spark/test/scenetest/CMakeLists.txt =================================================================== --- trunk/spark/test/scenetest/CMakeLists.txt 2011-03-24 16:29:33 UTC (rev 257) +++ trunk/spark/test/scenetest/CMakeLists.txt 2011-03-24 18:08:49 UTC (rev 258) @@ -9,7 +9,7 @@ ) include_directories(${SDL_INCLUDE_DIR} ${FREETYPE_INCLUDE_DIRS} - ${DevIL_INCLUDE_DIR}) + ${IL_INCLUDE_DIR}) if (NOT WIN32) add_executable(scenetest ${scenetest_SRCS}) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <he...@us...> - 2011-03-25 00:54:23
|
Revision: 261 http://simspark.svn.sourceforge.net/simspark/?rev=261&view=rev Author: hedayat Date: 2011-03-25 00:54:16 +0000 (Fri, 25 Mar 2011) Log Message: ----------- * Added TimerSystemSDL * Added Id SVN keyword to the new files * Some cleanups Modified Paths: -------------- trunk/spark/ChangeLog trunk/spark/lib/kerosin/inputserver/us.scan.rb trunk/spark/lib/oxygen/simulationserver/simulationserver.h trunk/spark/plugin/CMakeLists.txt trunk/spark/plugin/timersystemboost/timersystemboost.cpp Added Paths: ----------- trunk/spark/plugin/timersystemsdl/ trunk/spark/plugin/timersystemsdl/CMakeLists.txt trunk/spark/plugin/timersystemsdl/export.cpp trunk/spark/plugin/timersystemsdl/timersystemsdl.cpp trunk/spark/plugin/timersystemsdl/timersystemsdl.h trunk/spark/plugin/timersystemsdl/timersystemsdl_c.cpp Property Changed: ---------------- trunk/spark/lib/oxygen/simulationserver/timersystem.h trunk/spark/lib/oxygen/simulationserver/timersystem_c.cpp trunk/spark/plugin/timersystemboost/CMakeLists.txt trunk/spark/plugin/timersystemboost/export.cpp trunk/spark/plugin/timersystemboost/timersystemboost.cpp trunk/spark/plugin/timersystemboost/timersystemboost.h trunk/spark/plugin/timersystemboost/timersystemboost_c.cpp Modified: trunk/spark/ChangeLog =================================================================== --- trunk/spark/ChangeLog 2011-03-25 00:29:08 UTC (rev 260) +++ trunk/spark/ChangeLog 2011-03-25 00:54:16 UTC (rev 261) @@ -1,3 +1,22 @@ +2011-03-25 Hedayat Vatankhah <hed...@gm...> + + * lib/oxygen/simulationserver/simulationserver.h (SimulationServer): + - modify SetAutoTimeMode() documents to reflect new changes + + * plugin/timersystemboost/timersystemboost.cpp: + - small cleanups + + * plugin/timersystemsdl/timersystemsdl.h: + * plugin/timersystemsdl/timersystemsdl.cpp: + * plugin/timersystemsdl/timersystemsdl_c.cpp: + * plugin/timersystemsdl/export.cpp: + * plugin/timersystemsdl/CMakeLists.txt: + - added TimerSystemSDL based on inputsdl/timersdl implementation to replace + it. + + * lib/kerosin/inputserver/us.scan.rb: + - added a missing comma! + 2011-03-24 Hedayat Vatankhah <hed...@gm...> * spark/CMakeLists.txt: Modified: trunk/spark/lib/kerosin/inputserver/us.scan.rb =================================================================== --- trunk/spark/lib/kerosin/inputserver/us.scan.rb 2011-03-25 00:29:08 UTC (rev 260) +++ trunk/spark/lib/kerosin/inputserver/us.scan.rb 2011-03-25 00:54:16 UTC (rev 261) @@ -65,7 +65,7 @@ theInputSystem.addCode (Input.IC_KP8, 'kp8', '8'[0], '8'[0], 0); theInputSystem.addCode (Input.IC_KP9, 'kp9', '9'[0], '9'[0], 0); theInputSystem.addCode (Input.IC_KP_DECIMAL, 'kp_decimal', '.'[0], '.'[0], 0); - theInputSystem.addCode (Input.IC_KP_DIVIDE, 'kp_divide' '/'[0], '/'[0], 0); + theInputSystem.addCode (Input.IC_KP_DIVIDE, 'kp_divide', '/'[0], '/'[0], 0); theInputSystem.addCode (Input.IC_KP_MULTIPLY,'kp_multiply', '*'[0], '*'[0], 0); theInputSystem.addCode (Input.IC_KP_MINUS, 'kp_minus', '-'[0], '-'[0], 0); theInputSystem.addCode (Input.IC_KP_PLUS, 'kp_plus', '+'[0], '+'[0], 0); Modified: trunk/spark/lib/oxygen/simulationserver/simulationserver.h =================================================================== --- trunk/spark/lib/oxygen/simulationserver/simulationserver.h 2011-03-25 00:29:08 UTC (rev 260) +++ trunk/spark/lib/oxygen/simulationserver/simulationserver.h 2011-03-25 00:54:16 UTC (rev 261) @@ -98,8 +98,8 @@ /** sets the auto time mode of the SimulationServer. if set to true the SimulationServer automatically advances the simulation mSimStep time every cycle, this is the default - mode. Otherwise a registered ControlNode takes the - responsibility to do so (by calling AdvanceTime regularly) + mode. Otherwise a TimerSystem must provide SimulationServer with + timing features. */ void SetAutoTimeMode(bool set); Property changes on: trunk/spark/lib/oxygen/simulationserver/timersystem.h ___________________________________________________________________ Added: svn:keywords + Id Property changes on: trunk/spark/lib/oxygen/simulationserver/timersystem_c.cpp ___________________________________________________________________ Added: svn:keywords + Id Modified: trunk/spark/plugin/CMakeLists.txt =================================================================== --- trunk/spark/plugin/CMakeLists.txt 2011-03-25 00:29:08 UTC (rev 260) +++ trunk/spark/plugin/CMakeLists.txt 2011-03-25 00:54:16 UTC (rev 261) @@ -31,6 +31,7 @@ add_subdirectory(sceneeffector) add_subdirectory(soundsystemfmod) add_subdirectory(timersystemboost) +add_subdirectory(timersystemsdl) if (APPLE) if (DEVEL) add_subdirectory(imageperceptor) Property changes on: trunk/spark/plugin/timersystemboost/CMakeLists.txt ___________________________________________________________________ Added: svn:keywords + Id Property changes on: trunk/spark/plugin/timersystemboost/export.cpp ___________________________________________________________________ Added: svn:keywords + Id Modified: trunk/spark/plugin/timersystemboost/timersystemboost.cpp =================================================================== --- trunk/spark/plugin/timersystemboost/timersystemboost.cpp 2011-03-25 00:29:08 UTC (rev 260) +++ trunk/spark/plugin/timersystemboost/timersystemboost.cpp 2011-03-25 00:54:16 UTC (rev 261) @@ -40,10 +40,11 @@ void TimerSystemBoost::WaitFromLastQueryUntil(float deadline) { int milliseconds = round(deadline * 1000); + boost::thread::sleep(mLastQueryTime + + boost::posix_time::milliseconds(milliseconds)); + // GetLog()->Debug() << "(TimerSystemBoost) Waiting for " << deadline // << " seconds or " << milliseconds << " millisecs\n"; - boost::thread::sleep(mLastQueryTime + - boost::posix_time::milliseconds(milliseconds)); // GetLog()->Debug() << "CURRENT TIME: " << boost::get_system_time() << '\n'; } Property changes on: trunk/spark/plugin/timersystemboost/timersystemboost.cpp ___________________________________________________________________ Added: svn:keywords + Id Property changes on: trunk/spark/plugin/timersystemboost/timersystemboost.h ___________________________________________________________________ Added: svn:keywords + Id Property changes on: trunk/spark/plugin/timersystemboost/timersystemboost_c.cpp ___________________________________________________________________ Added: svn:keywords + Id Added: trunk/spark/plugin/timersystemsdl/CMakeLists.txt =================================================================== --- trunk/spark/plugin/timersystemsdl/CMakeLists.txt (rev 0) +++ trunk/spark/plugin/timersystemsdl/CMakeLists.txt 2011-03-25 00:54:16 UTC (rev 261) @@ -0,0 +1,19 @@ +########### next target ############### + +set(timersystemsdl_LIB_SRCS + export.cpp + timersystemsdl.cpp + timersystemsdl_c.cpp + timersystemsdl.h +) + +include_directories(${SDL_INCLUDE_DIR}) +add_library(timersystemsdl MODULE ${timersystemsdl_LIB_SRCS}) + +target_link_libraries(timersystemsdl ${spark_libs}) + +if (NOT APPLE) + set_target_properties(timersystemsdl PROPERTIES VERSION 0.0.0 SOVERSION 0) +endif (NOT APPLE) + +install(TARGETS timersystemsdl DESTINATION ${LIBDIR}/${CMAKE_PROJECT_NAME}) Property changes on: trunk/spark/plugin/timersystemsdl/CMakeLists.txt ___________________________________________________________________ Added: svn:keywords + Id Added: trunk/spark/plugin/timersystemsdl/export.cpp =================================================================== --- trunk/spark/plugin/timersystemsdl/export.cpp (rev 0) +++ trunk/spark/plugin/timersystemsdl/export.cpp 2011-03-25 00:54:16 UTC (rev 261) @@ -0,0 +1,27 @@ +/* -*- mode: c++; c-basic-offset: 4; indent-tabs-mode: nil -*- + + This file is part of rcssserver3D + Thu Mar 24 2011 + Copyright (C) 2003-1011 RoboCup Soccer Server 3D Maintenance Group + $Id$ + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; version 2 of the License. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +*/ +#include "timersystemsdl.h" +#include <zeitgeist/zeitgeist.h> + + using namespace oxygen; +ZEITGEIST_EXPORT_BEGIN() + ZEITGEIST_EXPORT(TimerSystemSDL); +ZEITGEIST_EXPORT_END() Property changes on: trunk/spark/plugin/timersystemsdl/export.cpp ___________________________________________________________________ Added: svn:keywords + Id Added: trunk/spark/plugin/timersystemsdl/timersystemsdl.cpp =================================================================== --- trunk/spark/plugin/timersystemsdl/timersystemsdl.cpp (rev 0) +++ trunk/spark/plugin/timersystemsdl/timersystemsdl.cpp 2011-03-25 00:54:16 UTC (rev 261) @@ -0,0 +1,73 @@ +/* -*- mode: c++; c-basic-offset: 4; indent-tabs-mode: nil -*- + + This file is part of rcssserver3D + Thu Mar 24 2011 + Copyright (C) 2003-1011 RoboCup Soccer Server 3D Maintenance Group + $Id$ + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; version 2 of the License. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +*/ +#include "timersystemsdl.h" +#include <zeitgeist/logserver/logserver.h> +#include <SDL.h> + +using namespace oxygen; + +void TimerSystemSDL::Initialize() +{ + if (!SDL_WasInit(SDL_INIT_TIMER)) + { + if (SDL_Init(SDL_INIT_TIMER) < 0) + { + GetLog()->Error() << "ERROR: (TimerSystemSDL) SDL Timer not initialized!\n"; + } + } + + mLastTicks = SDL_GetTicks(); +} + +float TimerSystemSDL::GetTimeSinceLastQuery() +{ + unsigned int ticks = SDL_GetTicks(); + + // FIXME: ticks might wrap + unsigned int timeDiff = ticks - mLastTicks; + mLastTicks = ticks; + + return timeDiff / 1000.0f; +} + +void TimerSystemSDL::WaitFromLastQueryUntil(float deadline) +{ + int milliseconds = round(deadline * 1000); + int expectedTime = mLastTicks + milliseconds; + + int delayTime = expectedTime - SDL_GetTicks(); + while (delayTime > 0) + { + SDL_Delay(delayTime); + // sometimes, even with the above SDL_Delay() call we will not reach + // the desired delay; so we check if we've actually reched the desired + // time + delayTime = expectedTime - SDL_GetTicks(); + } + +// GetLog()->Debug() << "(TimerSystemSDL) Waiting for " << deadline +// << " seconds or " << milliseconds << " millisecs\n"; +// GetLog()->Debug() << "CURRENT TIME: " << SDL_GetTicks() << '\n'; +} + +//void TimerSystemSDL::Finalize() +//{ +//} Property changes on: trunk/spark/plugin/timersystemsdl/timersystemsdl.cpp ___________________________________________________________________ Added: svn:keywords + Id Added: trunk/spark/plugin/timersystemsdl/timersystemsdl.h =================================================================== --- trunk/spark/plugin/timersystemsdl/timersystemsdl.h (rev 0) +++ trunk/spark/plugin/timersystemsdl/timersystemsdl.h 2011-03-25 00:54:16 UTC (rev 261) @@ -0,0 +1,61 @@ +/* -*- mode: c++; c-basic-offset: 4; indent-tabs-mode: nil -*- + + This file is part of rcssserver3D + Thu Mar 24 2011 + Copyright (C) 2003-1011 RoboCup Soccer Server 3D Maintenance Group + $Id$ + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; version 2 of the License. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +*/ +#ifndef OXYGEN_SDLTIMERSYSTEM_H +#define OXYGEN_SDLTIMERSYSTEM_H + +#include <oxygen/simulationserver/timersystem.h> + +namespace oxygen +{ +/** \class TimerSystemSDL is a timer system based on SDL timing facilities + */ +class TimerSystemSDL: public TimerSystem +{ +public: + /** initialize the timer system. It is called once at the beginning of a + * simulation. + */ + virtual void Initialize(); + + /** \return the elapsed time since the last call of this function or since + * the initialization for the first call. + */ + virtual float GetTimeSinceLastQuery(); + + /** waits until \param deadline seconds is passed since the last call to + * GetTimeSinceLastQuery(). If that is already passed, it'll return + * immediately. + */ + virtual void WaitFromLastQueryUntil(float deadline); + + /** this is called at the end of the simulation */ + virtual void Finalize() {} + +private: + /** the last time GetTimeSinceLastQuery is called or zero on Initialize() */ + unsigned long mLastTicks; +}; + +DECLARE_CLASS(TimerSystemSDL); + +} // namespace oxygen + +#endif // OXYGEN_SDLTIMERSYSTEM_H Property changes on: trunk/spark/plugin/timersystemsdl/timersystemsdl.h ___________________________________________________________________ Added: svn:keywords + Id Added: trunk/spark/plugin/timersystemsdl/timersystemsdl_c.cpp =================================================================== --- trunk/spark/plugin/timersystemsdl/timersystemsdl_c.cpp (rev 0) +++ trunk/spark/plugin/timersystemsdl/timersystemsdl_c.cpp 2011-03-25 00:54:16 UTC (rev 261) @@ -0,0 +1,28 @@ +/* -*- mode: c++; c-basic-offset: 4; indent-tabs-mode: nil -*- + + This file is part of rcssserver3D + Thu Mar 24 2011 + Copyright (C) 2003-1011 RoboCup Soccer Server 3D Maintenance Group + $Id$ + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; version 2 of the License. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +*/ +#include "timersystemsdl.h" + +using namespace oxygen; + +void CLASS(TimerSystemSDL)::DefineClass() +{ + DEFINE_BASECLASS(oxygen/TimerSystem); +} Property changes on: trunk/spark/plugin/timersystemsdl/timersystemsdl_c.cpp ___________________________________________________________________ Added: svn:keywords + Id This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <he...@us...> - 2011-03-25 22:43:21
|
Revision: 263 http://simspark.svn.sourceforge.net/simspark/?rev=263&view=rev Author: hedayat Date: 2011-03-25 22:43:15 +0000 (Fri, 25 Mar 2011) Log Message: ----------- * updated RELEASE and NEWS for 0.2.2 release * A small cleanup: SimulationServer::AdvanceTime() is now protected and InputControl don't try to advance time be default Modified Paths: -------------- trunk/spark/ChangeLog trunk/spark/NEWS trunk/spark/RELEASE trunk/spark/lib/kerosin/inputserver/inputcontrol.cpp trunk/spark/lib/oxygen/simulationserver/simulationserver.h trunk/spark/spark/spark.rb Modified: trunk/spark/ChangeLog =================================================================== --- trunk/spark/ChangeLog 2011-03-25 22:36:19 UTC (rev 262) +++ trunk/spark/ChangeLog 2011-03-25 22:43:15 UTC (rev 263) @@ -1,3 +1,22 @@ +2011-03-26 Hedayat Vatankhah <hed...@gm...> + + * NEWS: + * RELEASE: + - updated for 0.2.2 release + + * lib/kerosin/inputserver/inputcontrol.cpp (InputControl::InputControl): + - turn off advancing the time by InputControl(since it no longer works in + the new timing system). In fact, all timing code should be removed from + InputControl/InputSystem/InputServer and InputSystemSDL. + + * spark/spark.rb: + - removed the code to turn off InputControl's timing functionality as it + is off be default now + + * lib/oxygen/simulationserver/simulationserver.h (SimulationServer): + - made AdvanceTime() method protected: it is not expected to be called + externally anymore + 2011-03-25 Hedayat Vatankhah <hed...@gm...> * lib/oxygen/simulationserver/simulationserver.h (SimulationServer): Modified: trunk/spark/NEWS =================================================================== --- trunk/spark/NEWS 2011-03-25 22:36:19 UTC (rev 262) +++ trunk/spark/NEWS 2011-03-25 22:43:15 UTC (rev 263) @@ -1,3 +1,21 @@ +[0.2.2] +This release features many small enhancements which will benefit users. +It contains many bug fixes and performance improvements, in addition to +fixing some compilation issues. The behavior of ACC perceptor has been slightly +changed, and the multi-threaded mode should work without any known bugs. +Support for the camera sensor is improved too. More details are as follows: + +- ACC sensor provides raw data without any pre-processing + -- You can apply the following filter to 'RawACC' value received from the + simulator to get ACC value as what you'd receive in previous versions: + ACC = 0.9 * ACC + (0.1) * RawACC +- Using base64 encoding for camera perceptor +- Fixed bugs in multi-threaded mode. +- Compilation fixes +- HingePerceptor can report torque +- Better Performance +- New timing system result in more cleaner code and prevent wasting CPU time + [0.2.1] This release of simspark is prepared for RoboCup 2010 competitions in Singapore. In this release you can find some bug and compilation fixes, improved Windows Modified: trunk/spark/RELEASE =================================================================== --- trunk/spark/RELEASE 2011-03-25 22:36:19 UTC (rev 262) +++ trunk/spark/RELEASE 2011-03-25 22:43:15 UTC (rev 263) @@ -7,11 +7,15 @@ Support for the camera sensor is improved too. More details are as follows: - ACC sensor provides raw data without any pre-processing + -- You can apply the following filter to 'RawACC' value received from the + simulator to get ACC value as what you'd receive in previous versions: + ACC = 0.9 * ACC + (0.1) * RawACC - Using base64 encoding for camera perceptor - Fixed bugs in multi-threaded mode. - Compilation fixes - HingePerceptor can report torque - Better Performance +- New timing system result in more cleaner code and prevent wasting CPU time You can get the package on the Simspark page on SourceForge at http://sourceforge.net/projects/simspark/ Modified: trunk/spark/lib/kerosin/inputserver/inputcontrol.cpp =================================================================== --- trunk/spark/lib/kerosin/inputserver/inputcontrol.cpp 2011-03-25 22:36:19 UTC (rev 262) +++ trunk/spark/lib/kerosin/inputserver/inputcontrol.cpp 2011-03-25 22:43:15 UTC (rev 263) @@ -35,7 +35,7 @@ mDeltaTime = 0; mHorSens = 0.3f; mVertSens = 0.3f; - mAdvanceTime = true; + mAdvanceTime = false; mMouseLook = false; } @@ -229,11 +229,12 @@ } } - if (mAdvanceTime) - { - // pass the delta time on to the SimulationServer - GetSimulationServer()->AdvanceTime(mDeltaTime); - } + // No longer works +// if (mAdvanceTime) +// { +// // pass the delta time on to the SimulationServer +// GetSimulationServer()->AdvanceTime(mDeltaTime); +// } } float Modified: trunk/spark/lib/oxygen/simulationserver/simulationserver.h =================================================================== --- trunk/spark/lib/oxygen/simulationserver/simulationserver.h 2011-03-25 22:36:19 UTC (rev 262) +++ trunk/spark/lib/oxygen/simulationserver/simulationserver.h 2011-03-25 22:43:15 UTC (rev 263) @@ -58,7 +58,7 @@ public: SimulationServer(); - ~SimulationServer(); + virtual ~SimulationServer(); /** exits the simulation on the next simulation step */ static void Quit(); @@ -78,11 +78,6 @@ /** returns the simulation time step */ virtual float GetSimStep(); - /** increases the accumulated time since the last simulation step, - but does not step the simulation - */ - virtual void AdvanceTime(float deltaTime); - /** returns the accumulated time since the last simulation step */ virtual float GetSumDeltaTime(); @@ -158,6 +153,11 @@ protected: virtual void OnLink(); + /** increases the accumulated time since the last simulation step, + but does not step the simulation + */ + virtual void AdvanceTime(float deltaTime); + /** advances the simulation mSumDeltaTime seconds. If mSimStep is nonzero this is done in discrete steps */ virtual void Step(); Modified: trunk/spark/spark/spark.rb =================================================================== --- trunk/spark/spark/spark.rb 2011-03-25 22:36:19 UTC (rev 262) +++ trunk/spark/spark/spark.rb 2011-03-25 22:43:15 UTC (rev 263) @@ -413,12 +413,6 @@ # add the input control node simulationServer.initControlNode('kerosin/InputControl','InputControl') end - - # set timing mode (real time vs simulation time) - inputControl = get($serverPath+'simulation/InputControl') - if (inputControl != nil) - inputControl.setAdvanceTime(false) - end end def sparkSetupTimer(timerSystem = $defaultTimerSystem) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <he...@us...> - 2011-03-26 02:16:43
|
Revision: 264 http://simspark.svn.sourceforge.net/simspark/?rev=264&view=rev Author: hedayat Date: 2011-03-26 02:16:36 +0000 (Sat, 26 Mar 2011) Log Message: ----------- * S-Expression library is now thread-safe. It was the source of crashes in multi-threaded mode Modified Paths: -------------- trunk/spark/ChangeLog trunk/spark/plugin/rubysceneimporter/rubysceneimporter.cpp trunk/spark/plugin/rubysceneimporter/rubysceneimporter.h trunk/spark/plugin/sexpparser/sexpparser.cpp trunk/spark/plugin/sexpparser/sexpparser.h trunk/spark/plugin/sparkmonitor/sparkmonitorclient.cpp trunk/spark/plugin/sparkmonitor/sparkmonitorclient.h trunk/spark/plugin/sparkmonitor/sparkmonitorlogfileserver.cpp trunk/spark/plugin/sparkmonitor/sparkmonitorlogfileserver.h trunk/spark/utility/sfsexp/io.c trunk/spark/utility/sfsexp/parser.c trunk/spark/utility/sfsexp/sexp.c trunk/spark/utility/sfsexp/sexp.h trunk/spark/utility/sfsexp/sexp_ops.c trunk/spark/utility/sfsexp/sexp_ops.h Modified: trunk/spark/ChangeLog =================================================================== --- trunk/spark/ChangeLog 2011-03-25 22:43:15 UTC (rev 263) +++ trunk/spark/ChangeLog 2011-03-26 02:16:36 UTC (rev 264) @@ -1,5 +1,24 @@ 2011-03-26 Hedayat Vatankhah <hed...@gm...> + * plugin/sexpparser/sexpparser.h: + * plugin/sexpparser/sexpparser.cpp: + * plugin/rubysceneimporter/rubysceneimporter.h: + * plugin/rubysceneimporter/rubysceneimporter.cpp: + * plugin/sparkmonitor/sparkmonitorclient.h: + * plugin/sparkmonitor/sparkmonitorclient.cpp: + * plugin/sparkmonitor/sparkmonitorlogfileserver.h: + * plugin/sparkmonitor/sparkmonitorlogfileserver.cpp: + - updated to be compatible with the reentrant s-expression library + + * utility/sfsexp/sexp.h: + * utility/sfsexp/sexp.c: + * utility/sfsexp/parser.c: + * utility/sfsexp/io.c: + * utility/sfsexp/sexp_ops.c: + * utility/sfsexp/sexp_ops.h: + - s-expression library is now reentrant and thread-safe. solves many + crashes in multi-threaded mode + * NEWS: * RELEASE: - updated for 0.2.2 release Modified: trunk/spark/plugin/rubysceneimporter/rubysceneimporter.cpp =================================================================== --- trunk/spark/plugin/rubysceneimporter/rubysceneimporter.cpp 2011-03-25 22:43:15 UTC (rev 263) +++ trunk/spark/plugin/rubysceneimporter/rubysceneimporter.cpp 2011-03-26 02:16:36 UTC (rev 264) @@ -86,10 +86,12 @@ mUpdateSceneDict = false; InitTranslationTable(); + mSexpMemory = init_sexp_memory(); } RubySceneImporter::~RubySceneImporter() { + destroy_sexp_memory(mSexpMemory); } void RubySceneImporter::SetUnlinkOnCompleteScenes(bool unlink) @@ -180,7 +182,8 @@ { // parse s-expressions pcont_t* pcont = init_continuation(const_cast<char*>(scene)); - sexp_t* sexp = iparse_sexp(const_cast<char*>(scene),size,pcont); + sexp_t* sexp = iparse_sexp(mSexpMemory, + const_cast<char*>(scene), size, pcont); // read scene magic and version if ( @@ -190,16 +193,16 @@ (mVersionMinor != 1) ) { - destroy_sexp(sexp); - destroy_continuation(pcont); + destroy_sexp(mSexpMemory, sexp); + destroy_continuation(mSexpMemory, pcont); return false; } // advance to next sexpression- the scene graph PushParameter(parameter); - destroy_sexp(sexp); - sexp = iparse_sexp(const_cast<char*>(scene),size,pcont); + destroy_sexp(mSexpMemory, sexp); + sexp = iparse_sexp(mSexpMemory, const_cast<char*>(scene), size, pcont); if (sexp == 0) { @@ -223,8 +226,8 @@ ReadDeltaGraph(sexp,root) : ReadGraph(sexp,root); - destroy_sexp(sexp); - destroy_continuation(pcont); + destroy_sexp(mSexpMemory, sexp); + destroy_continuation(mSexpMemory, pcont); InvokeMethods(); PopParameter(); @@ -489,7 +492,7 @@ { return false; } - } + } else { if (! EvalParameter(sexp->list, atom)) Modified: trunk/spark/plugin/rubysceneimporter/rubysceneimporter.h =================================================================== --- trunk/spark/plugin/rubysceneimporter/rubysceneimporter.h 2011-03-25 22:43:15 UTC (rev 263) +++ trunk/spark/plugin/rubysceneimporter/rubysceneimporter.h 2011-03-26 02:16:36 UTC (rev 264) @@ -140,6 +140,9 @@ /** the abbreviaton table */ TTranslationTable mTranslationTable; + + /** the s-expression library memory management object */ + sexp_mem_t *mSexpMemory; }; DECLARE_CLASS(RubySceneImporter); Modified: trunk/spark/plugin/sexpparser/sexpparser.cpp =================================================================== --- trunk/spark/plugin/sexpparser/sexpparser.cpp 2011-03-25 22:43:15 UTC (rev 263) +++ trunk/spark/plugin/sexpparser/sexpparser.cpp 2011-03-26 02:16:36 UTC (rev 264) @@ -30,10 +30,12 @@ SexpParser::SexpParser() : BaseParser() { + mSexpMemory = init_sexp_memory(); } SexpParser::~SexpParser() { + destroy_sexp_memory(mSexpMemory); } boost::shared_ptr<PredicateList> @@ -49,16 +51,18 @@ char* c = const_cast<char*>(input.c_str()); pcont_t* pcont = init_continuation(c); - sexp_t* sexp = iparse_sexp(c,static_cast<int>(input.size()),pcont); + sexp_t* sexp = iparse_sexp(mSexpMemory, c, static_cast<int>(input.size()), + pcont); while (sexp != 0) { SexpToPredicate(predList,sexp); - destroy_sexp(sexp); - sexp = iparse_sexp(c,static_cast<int>(input.size()),pcont); + destroy_sexp(mSexpMemory, sexp); + sexp = iparse_sexp(mSexpMemory, c, static_cast<int>(input.size()), + pcont); } - destroy_continuation(pcont); + destroy_continuation(mSexpMemory, pcont); return predList; } Modified: trunk/spark/plugin/sexpparser/sexpparser.h =================================================================== --- trunk/spark/plugin/sexpparser/sexpparser.h 2011-03-25 22:43:15 UTC (rev 263) +++ trunk/spark/plugin/sexpparser/sexpparser.h 2011-03-26 02:16:36 UTC (rev 264) @@ -48,6 +48,10 @@ void PredicateToString(std::stringstream& ss, const oxygen::Predicate& predicate); + +private: + /** the s-expression library memory management object */ + sexp_mem_t *mSexpMemory; }; DECLARE_CLASS(SexpParser); Modified: trunk/spark/plugin/sparkmonitor/sparkmonitorclient.cpp =================================================================== --- trunk/spark/plugin/sparkmonitor/sparkmonitorclient.cpp 2011-03-25 22:43:15 UTC (rev 263) +++ trunk/spark/plugin/sparkmonitor/sparkmonitorclient.cpp 2011-03-26 02:16:36 UTC (rev 264) @@ -38,10 +38,12 @@ SparkMonitorClient::SparkMonitorClient() : NetClient() { + mSexpMemory = init_sexp_memory(); } SparkMonitorClient::~SparkMonitorClient() { + destroy_sexp_memory(mSexpMemory); } void SparkMonitorClient::OnLink() @@ -192,7 +194,7 @@ mActiveScene = mSceneServer->GetActiveScene(); mActiveScene->UpdateCache(); - + if (mActiveScene.get() == 0) { return; @@ -220,12 +222,12 @@ char* msgBuf = const_cast<char*>(msg.c_str()); pcont_t* pcont = init_continuation(msgBuf); - sexp_t* sexp_custom = iparse_sexp(msgBuf,msg.size(),pcont); + sexp_t* sexp_custom = iparse_sexp(mSexpMemory, msgBuf, msg.size(), pcont); if (sexp_custom == 0) { - destroy_sexp(sexp_custom); - destroy_continuation(pcont); + destroy_sexp(mSexpMemory, sexp_custom); + destroy_continuation(mSexpMemory, pcont); return; } @@ -234,9 +236,9 @@ mSceneImporter->ParseScene(string(pcont->lastPos), mManagedScene, boost::shared_ptr<ParameterList>()); - + mActiveScene->SetModified(true); - destroy_sexp(sexp_custom); - destroy_continuation(pcont); + destroy_sexp(mSexpMemory, sexp_custom); + destroy_continuation(mSexpMemory, pcont); } Modified: trunk/spark/plugin/sparkmonitor/sparkmonitorclient.h =================================================================== --- trunk/spark/plugin/sparkmonitor/sparkmonitorclient.h 2011-03-25 22:43:15 UTC (rev 263) +++ trunk/spark/plugin/sparkmonitor/sparkmonitorclient.h 2011-03-26 02:16:36 UTC (rev 264) @@ -72,6 +72,9 @@ /** the root node of the managed scene */ boost::shared_ptr<oxygen::BaseNode> mManagedScene; + + /** the s-expression library memory management object */ + sexp_mem_t *mSexpMemory; }; DECLARE_CLASS(SparkMonitorClient); Modified: trunk/spark/plugin/sparkmonitor/sparkmonitorlogfileserver.cpp =================================================================== --- trunk/spark/plugin/sparkmonitor/sparkmonitorlogfileserver.cpp 2011-03-25 22:43:15 UTC (rev 263) +++ trunk/spark/plugin/sparkmonitor/sparkmonitorlogfileserver.cpp 2011-03-26 02:16:36 UTC (rev 264) @@ -44,10 +44,12 @@ mForwardStep = false; mStepDelay = 0; mBackwardPlayback = false; + mSexpMemory = init_sexp_memory(); } SparkMonitorLogFileServer::~SparkMonitorLogFileServer() { + destroy_sexp_memory(mSexpMemory); } void SparkMonitorLogFileServer::OnLink() @@ -136,7 +138,7 @@ { ParseMessage(msg); } - + #ifdef WIN32 Sleep(mStepDelay / 1000); #else @@ -225,7 +227,7 @@ { return; } - + mActiveScene = mSceneServer->GetActiveScene(); if (mActiveScene.get() == 0) @@ -255,12 +257,12 @@ char* msgBuf = const_cast<char*>(msg.c_str()); pcont_t* pcont = init_continuation(msgBuf); - sexp_t* sexp_custom = iparse_sexp(msgBuf,msg.size(),pcont); + sexp_t* sexp_custom = iparse_sexp(mSexpMemory, msgBuf, msg.size(), pcont); if (sexp_custom == 0) { - destroy_sexp(sexp_custom); - destroy_continuation(pcont); + destroy_sexp(mSexpMemory, sexp_custom); + destroy_continuation(mSexpMemory, pcont); return; } @@ -270,8 +272,8 @@ mManagedScene, boost::shared_ptr<ParameterList>()); - destroy_sexp(sexp_custom); - destroy_continuation(pcont); + destroy_sexp(mSexpMemory, sexp_custom); + destroy_continuation(mSexpMemory, pcont); } void Modified: trunk/spark/plugin/sparkmonitor/sparkmonitorlogfileserver.h =================================================================== --- trunk/spark/plugin/sparkmonitor/sparkmonitorlogfileserver.h 2011-03-25 22:43:15 UTC (rev 263) +++ trunk/spark/plugin/sparkmonitor/sparkmonitorlogfileserver.h 2011-03-26 02:16:36 UTC (rev 264) @@ -114,6 +114,9 @@ /** cached reference to the script server */ boost::shared_ptr<zeitgeist::ScriptServer> mScriptServer; + + /** the s-expression library memory management object */ + sexp_mem_t *mSexpMemory; }; DECLARE_CLASS(SparkMonitorLogFileServer); Modified: trunk/spark/utility/sfsexp/io.c =================================================================== --- trunk/spark/utility/sfsexp/io.c 2011-03-25 22:43:15 UTC (rev 263) +++ trunk/spark/utility/sfsexp/io.c 2011-03-26 02:16:36 UTC (rev 264) @@ -66,17 +66,17 @@ /** * */ -void destroy_iowrap(sexp_iowrap_t *iow) { +void destroy_iowrap(sexp_mem_t *smem, sexp_iowrap_t *iow) { if (iow == NULL) return; /* idiot */ - destroy_continuation(iow->cc); + destroy_continuation(smem, iow->cc); free(iow); } /** * */ -sexp_t *read_one_sexp(sexp_iowrap_t *iow) { +sexp_t *read_one_sexp(sexp_mem_t *smem, sexp_iowrap_t *iow) { sexp_t *sx = NULL; if (iow->cnt == 0) { @@ -84,7 +84,7 @@ if (iow->cnt == 0) return NULL; } - iow->cc = cparse_sexp(iow->buf,iow->cnt,iow->cc); + iow->cc = cparse_sexp(smem, iow->buf,iow->cnt,iow->cc); while (iow->cc->last_sexp == NULL) { if (iow->cc->error != 0) { @@ -97,7 +97,7 @@ if (iow->cnt == 0) return NULL; - iow->cc = cparse_sexp(iow->buf,iow->cnt,iow->cc); + iow->cc = cparse_sexp(smem, iow->buf,iow->cnt,iow->cc); } sx = iow->cc->last_sexp; Modified: trunk/spark/utility/sfsexp/parser.c =================================================================== --- trunk/spark/utility/sfsexp/parser.c 2011-03-25 22:43:15 UTC (rev 263) +++ trunk/spark/utility/sfsexp/parser.c 2011-03-26 02:16:36 UTC (rev 264) @@ -70,48 +70,33 @@ parse_data_t; /** - * parse_data_t stack - similar malloc prevention to sexp_t_cache. - */ -faststack_t *pd_cache; - -/** - * The global <I>sexp_t_cache</I> is a faststack implementing a cache of - * pre-alloced s-expression element entities. Odds are a user should never - * touch this. If you do, you're on your own. This is used internally by - * the parser and related code to store unused but allocated sexp_t elements. - * This should be left alone and manipulated only by the sexp_t_allocate and - * sexp_t_deallocate functions. Touching the stack is bad. - */ -faststack_t *sexp_t_cache; - -/** * sexp_t allocation */ #ifdef _NO_MEMORY_MANAGEMENT_ sexp_t * -sexp_t_allocate() { +sexp_t_allocate(smem) { sexp_t *sx = (sexp_t *) calloc(1, sizeof(sexp_t)); assert(sx != NULL); return(sx); } #else sexp_t * -sexp_t_allocate() { +sexp_t_allocate(sexp_mem_t *smem) { sexp_t *sx; stack_lvl_t *l; - if (sexp_t_cache == NULL) { - sexp_t_cache = make_stack(); + if (smem->sexp_t_cache == NULL) { + smem->sexp_t_cache = make_stack(); sx = (sexp_t *)malloc(sizeof(sexp_t)); assert(sx != NULL); sx->next = sx->list = NULL; } else { - if (empty_stack(sexp_t_cache)) { + if (empty_stack(smem->sexp_t_cache)) { sx = (sexp_t *)malloc(sizeof(sexp_t)); assert(sx != NULL); sx->next = sx->list = NULL; } else { - l = pop(sexp_t_cache); + l = pop(smem->sexp_t_cache); sx = (sexp_t *)l->data; } } @@ -130,8 +115,8 @@ } #else void -sexp_t_deallocate(sexp_t *s) { - if (sexp_t_cache == NULL) sexp_t_cache = make_stack(); +sexp_t_deallocate(sexp_mem_t *smem, sexp_t *s) { + if (smem->sexp_t_cache == NULL) smem->sexp_t_cache = make_stack(); if (s == NULL) return; @@ -142,39 +127,39 @@ s->val = NULL; - sexp_t_cache = push(sexp_t_cache, s); + smem->sexp_t_cache = push(smem->sexp_t_cache, s); } #endif /** * cleanup the sexp library. Note this is implemented HERE since we need - * to know about pd_cache, which is local to this file. + * to know about smem->pd_cache, which is local to this file. */ #ifdef _NO_MEMORY_MANAGEMENT_ void sexp_cleanup() { } #else -void sexp_cleanup() { +void sexp_cleanup(sexp_mem_t *smem) { stack_lvl_t *l; - if (pd_cache != NULL) { - l = pd_cache->top; + if (smem->pd_cache != NULL) { + l = smem->pd_cache->top; while (l != NULL) { free(l->data); l = l->below; } - destroy_stack(pd_cache); - pd_cache = NULL; + destroy_stack(smem->pd_cache); + smem->pd_cache = NULL; } - if (sexp_t_cache != NULL) { - l = sexp_t_cache->top; + if (smem->sexp_t_cache != NULL) { + l = smem->sexp_t_cache->top; while (l != NULL) { free(l->data); l = l->below; } - destroy_stack(sexp_t_cache); - sexp_t_cache = NULL; + destroy_stack(smem->sexp_t_cache); + smem->sexp_t_cache = NULL; } } #endif @@ -183,20 +168,20 @@ * allocation */ parse_data_t * -pd_allocate() { +pd_allocate(sexp_mem_t *smem) { parse_data_t *p; stack_lvl_t *l; - if (pd_cache == NULL) { - pd_cache = make_stack(); + if (smem->pd_cache == NULL) { + smem->pd_cache = make_stack(); p = (parse_data_t *)malloc(sizeof(parse_data_t)); assert(p!=NULL); } else { - if (empty_stack(pd_cache)) { + if (empty_stack(smem->pd_cache)) { p = (parse_data_t *)malloc(sizeof(parse_data_t)); assert(p!=NULL); } else { - l = pop(pd_cache); + l = pop(smem->pd_cache); p = (parse_data_t *)l->data; } } @@ -208,10 +193,10 @@ * de-allocation */ void -pd_deallocate(parse_data_t *p) { - if (pd_cache == NULL) pd_cache = make_stack(); +pd_deallocate(sexp_mem_t *smem, parse_data_t *p) { + if (smem->pd_cache == NULL) smem->pd_cache = make_stack(); - pd_cache = push(pd_cache, p); + smem->pd_cache = push(smem->pd_cache, p); } /** @@ -220,7 +205,7 @@ * buffers, stacks, etc.. */ void -destroy_continuation (pcont_t * pc) +destroy_continuation (sexp_mem_t *smem, pcont_t * pc) { stack_lvl_t *lvl; parse_data_t *lvl_data; @@ -244,11 +229,11 @@ */ if (lvl_data != NULL) { lvl_data->lst = NULL; - destroy_sexp(lvl_data->fst); + destroy_sexp(smem, lvl_data->fst); lvl_data->fst = NULL; /* free(lvl_data); */ - pd_deallocate(lvl_data); + pd_deallocate(smem, lvl_data); lvl->data = lvl_data = NULL; } @@ -283,17 +268,17 @@ * than one will act up. */ sexp_t * -parse_sexp (char *s, int len) +parse_sexp (sexp_mem_t *smem, char *s, int len) { pcont_t *pc = NULL; sexp_t *sx = NULL; if (len < 1 || s == NULL) return NULL; /* empty string - return */ - pc = cparse_sexp (s, len, pc); + pc = cparse_sexp (smem, s, len, pc); sx = pc->last_sexp; - destroy_continuation(pc); + destroy_continuation(smem, pc); return sx; } @@ -343,7 +328,7 @@ * repeated calls. */ sexp_t * -iparse_sexp (char *s, int len, pcont_t *cc) { +iparse_sexp (sexp_mem_t *smem, char *s, int len, pcont_t *cc) { pcont_t *pc; sexp_t *sx = NULL; @@ -356,7 +341,7 @@ } /* call the parser */ - pc = cparse_sexp(s,len,cc); + pc = cparse_sexp(smem, s,len,cc); if (cc->last_sexp != NULL) { sx = cc->last_sexp; @@ -376,7 +361,7 @@ * Continuation based parser - the guts of the package. */ pcont_t * -cparse_sexp (char *str, int len, pcont_t *lc) +cparse_sexp (sexp_mem_t *smem, char *str, int len, pcont_t *lc) { char *t, *s; register unsigned int binexpected = 0; @@ -567,7 +552,7 @@ /* open paren */ depth++; - sx = sexp_t_allocate(); + sx = sexp_t_allocate(smem); assert(sx!=NULL); elts++; sx->ty = SEXP_LIST; @@ -577,7 +562,7 @@ if (stack->height < 1) { - data = pd_allocate(); + data = pd_allocate(smem); assert(data!=NULL); data->fst = data->lst = sx; push (stack, data); @@ -592,7 +577,7 @@ data->lst = sx; } - data = pd_allocate(); + data = pd_allocate(smem); assert(data!=NULL); data->fst = data->lst = NULL; push (stack, data); @@ -637,7 +622,7 @@ data = (parse_data_t *) lvl->data; sx = data->fst; /* free (data); */ - pd_deallocate(data); + pd_deallocate(smem, data); lvl->data = NULL; if (stack->top != NULL) @@ -672,7 +657,7 @@ data = (parse_data_t *) lvl->data; sx = data->fst; /* free (data); */ - pd_deallocate(data); + pd_deallocate(smem, data); lvl->data = NULL; } cc->last_sexp = sx; @@ -707,7 +692,7 @@ vcur[0] = '\0'; val_used++; - sx = sexp_t_allocate(); + sx = sexp_t_allocate(smem); assert(sx!=NULL); elts++; sx->ty = SEXP_VALUE; @@ -839,7 +824,7 @@ vcur[0] = '\0'; val_used++; - sx = sexp_t_allocate(); + sx = sexp_t_allocate(smem); assert(sx!=NULL); elts++; sx->ty = SEXP_VALUE; @@ -994,7 +979,7 @@ { state = 1; vcur[0] = '\0'; - sx = sexp_t_allocate(); + sx = sexp_t_allocate(smem); assert(sx!=NULL); elts++; sx->ty = SEXP_VALUE; @@ -1165,7 +1150,7 @@ if (binread == binexpected) { /* state = 1 -- create a sexp_t and head back */ - sx = sexp_t_allocate(); + sx = sexp_t_allocate(smem); assert(sx!=NULL); elts++; sx->ty = SEXP_VALUE; @@ -1239,7 +1224,7 @@ data = (parse_data_t *) lvl->data; sx = data->fst; /* free (data); */ - pd_deallocate(data); + pd_deallocate(smem, data); lvl->data = NULL; } cc->last_sexp = sx; Modified: trunk/spark/utility/sfsexp/sexp.c =================================================================== --- trunk/spark/utility/sfsexp/sexp.c 2011-03-25 22:43:15 UTC (rev 263) +++ trunk/spark/utility/sfsexp/sexp.c 2011-03-26 02:16:36 UTC (rev 264) @@ -41,27 +41,41 @@ #define snprintf _snprintf #endif +sexp_mem_t *init_sexp_memory() +{ + sexp_mem_t *smem = malloc(sizeof(sexp_mem_t)); + smem->pd_cache = NULL; + smem->sexp_t_cache = NULL; + return smem; +} + +void destroy_sexp_memory(sexp_mem_t *smem) +{ + if (smem) + free(smem); +} + /** * Recursively walk an s-expression and free it. */ void -destroy_sexp (sexp_t * s) +destroy_sexp (sexp_mem_t *smem, sexp_t * s) { if (s == NULL) return; if (s->ty == SEXP_LIST) - destroy_sexp (s->list); + destroy_sexp (smem, s->list); if (s->ty == SEXP_VALUE && s->val != NULL) free(s->val); s->val = NULL; - destroy_sexp (s->next); + destroy_sexp (smem, s->next); s->next = s->list = NULL; - sexp_t_deallocate(s); + sexp_t_deallocate(smem, s); } /** @@ -69,7 +83,7 @@ * representation of the s-expression. Fills the buffer. */ int -print_sexp (char *buf, int size, sexp_t * sx) +print_sexp (sexp_mem_t *smem, char *buf, int size, sexp_t * sx) { int retval; int sz; @@ -86,7 +100,7 @@ return -1; } - fakehead = sexp_t_allocate(); + fakehead = sexp_t_allocate(smem); assert(fakehead!=NULL); /* duplicate the head to prevent going down a sx->next path @@ -302,7 +316,7 @@ } destroy_stack (stack); - sexp_t_deallocate(fakehead); + sexp_t_deallocate(smem, fakehead); return retval; } @@ -312,7 +326,7 @@ * representation of the s-expression. Fills the buffer. */ int -print_sexp_cstr (CSTRING **s, sexp_t *sx, int ss, int gs) +print_sexp_cstr (sexp_mem_t *smem, CSTRING **s, sexp_t *sx, int ss, int gs) { int retval; char *tc; @@ -333,7 +347,7 @@ _s = snew(ss); sgrowsize(gs); - fakehead = sexp_t_allocate(); + fakehead = sexp_t_allocate(smem); assert(fakehead!=NULL); /* duplicate the head to prevent going down a sx->next path @@ -457,7 +471,7 @@ retval = _s->curlen; destroy_stack (stack); - sexp_t_deallocate(fakehead); + sexp_t_deallocate(smem, fakehead); return retval; } @@ -465,8 +479,8 @@ /** * Allocate a new sexp_t element representing a list. */ -sexp_t *new_sexp_list(sexp_t *l) { - sexp_t *sx = sexp_t_allocate(); +sexp_t *new_sexp_list(sexp_mem_t *smem, sexp_t *l) { + sexp_t *sx = sexp_t_allocate(smem); sx->ty = SEXP_LIST; @@ -482,8 +496,8 @@ /** * allocate a new sexp_t element representing a value */ -sexp_t *new_sexp_atom(char *buf, int bs) { - sexp_t *sx = sexp_t_allocate(); +sexp_t *new_sexp_atom(sexp_mem_t *smem, char *buf, int bs) { + sexp_t *sx = sexp_t_allocate(smem); sx->ty = SEXP_VALUE; Modified: trunk/spark/utility/sfsexp/sexp.h =================================================================== --- trunk/spark/utility/sfsexp/sexp.h 2011-03-25 22:43:15 UTC (rev 263) +++ trunk/spark/utility/sfsexp/sexp.h 2011-03-26 02:16:36 UTC (rev 264) @@ -200,6 +200,24 @@ /* STRUCTURES */ /*============*/ +typedef struct sexp_mem +{ + /** + * parse_data_t stack - similar malloc prevention to sexp_t_cache. + */ + faststack_t *pd_cache; + + /** + * The global <I>sexp_t_cache</I> is a faststack implementing a cache of + * pre-alloced s-expression element entities. Odds are a user should never + * touch this. If you do, you're on your own. This is used internally by + * the parser and related code to store unused but allocated sexp_t elements. + * This should be left alone and manipulated only by the sexp_t_allocate and + * sexp_t_deallocate functions. Touching the stack is bad. + */ + faststack_t *sexp_t_cache; +} sexp_mem_t; + /** * An s-expression is represented as a linked structure of elements, * where each element is either an <I>atom</I> or <I>list</I>. An @@ -550,14 +568,14 @@ * sexp_t_deallocate to deallocate them and put them in the pool.</I> * Also, if the stack has not been initialized yet, this does so. */ - sexp_t *sexp_t_allocate(); + sexp_t *sexp_t_allocate(sexp_mem_t *smem); /** * given a malloc'd sexp_t element, put it back into the already-allocated * element stack. This method will allocate a stack if one has not been * allocated already. */ - void sexp_t_deallocate(sexp_t *s); + void sexp_t_deallocate(sexp_mem_t *smem, sexp_t *s); /** * In the event that someone wants us to release ALL of the memory used @@ -565,7 +583,7 @@ * this, the caches will be persistent for the lifetime of the library * user. */ - void sexp_cleanup(); + void sexp_cleanup(sexp_mem_t *smem); /** * print a sexp_t struct as a string in the LISP style. If the buffer @@ -575,7 +593,7 @@ * value is -1 and the contents of the buffer should not be assumed to * contain any useful information. */ - int print_sexp(char *loc, int size, sexp_t *e); + int print_sexp(sexp_mem_t *smem, char *loc, int size, sexp_t *e); /** * print a sexp_t structure to a buffer, growing it as necessary instead @@ -583,17 +601,17 @@ * to tune for performance reasons are <tt>ss</tt> and <tt>gs</tt> - the * buffer start size and growth size. */ - int print_sexp_cstr(CSTRING **s, sexp_t *e, int ss, int gs); + int print_sexp_cstr(sexp_mem_t *smem, CSTRING **s, sexp_t *e, int ss, int gs); /** * Allocate a new sexp_t element representing a list. */ - sexp_t *new_sexp_list(sexp_t *l); + sexp_t *new_sexp_list(sexp_mem_t *smem, sexp_t *l); /** * allocate a new sexp_t element representing a value */ - sexp_t *new_sexp_atom(char *buf, int bs); + sexp_t *new_sexp_atom(sexp_mem_t *smem, char *buf, int bs); /** * create an initial continuation for parsing the given string @@ -604,7 +622,7 @@ * destroy a continuation. This involves cleaning up what it contains, * and cleaning up the continuation itself. */ - void destroy_continuation (pcont_t * pc); + void destroy_continuation (sexp_mem_t *smem, pcont_t * pc); /** * create an IO wrapper structure around a file descriptor. @@ -614,7 +632,7 @@ /** * destroy an IO wrapper structure */ - void destroy_iowrap(sexp_iowrap_t *iow); + void destroy_iowrap(sexp_mem_t *smem, sexp_iowrap_t *iow); /** * given and IO wrapper handle, read one s-expression off of it. this @@ -622,24 +640,24 @@ * guarantee that under the covers an IO read actually is occuring. * returning null implies no s-expression was able to be read. */ - sexp_t *read_one_sexp(sexp_iowrap_t *iow); + sexp_t *read_one_sexp(sexp_mem_t *smem, sexp_iowrap_t *iow); /** * wrapper around parser for compatibility. */ - sexp_t *parse_sexp(char *s, int len); + sexp_t *parse_sexp(sexp_mem_t *smem, char *s, int len); /** * wrapper around parser for friendlier continuation use * pre-condition : continuation (cc) is NON-NULL! */ - sexp_t *iparse_sexp(char *s, int len, pcont_t *cc); + sexp_t *iparse_sexp(sexp_mem_t *smem, char *s, int len, pcont_t *cc); /** * given a LISP style s-expression string, parse it into a set of * connected sexp_t structures. */ - pcont_t *cparse_sexp(char *s, int len, pcont_t *pc); + pcont_t *cparse_sexp(sexp_mem_t *smem, char *s, int len, pcont_t *pc); /** * given a sexp_t structure, free the memory it uses (and recursively free @@ -649,8 +667,11 @@ * pre-allocated elements. This is an optimization to speed up the * parser to eliminate wasteful free and re-malloc calls. */ - void destroy_sexp(sexp_t *s); + void destroy_sexp(sexp_mem_t *smem, sexp_t *s); + sexp_mem_t *init_sexp_memory(); + void destroy_sexp_memory(sexp_mem_t *smem); + /* this is for C++ users */ #ifdef __cplusplus } Modified: trunk/spark/utility/sfsexp/sexp_ops.c =================================================================== --- trunk/spark/utility/sfsexp/sexp_ops.c 2011-03-25 22:43:15 UTC (rev 263) +++ trunk/spark/utility/sfsexp/sexp_ops.c 2011-03-26 02:16:36 UTC (rev 264) @@ -121,12 +121,12 @@ /** * Copy an s-expression. */ -sexp_t *copy_sexp(sexp_t *s) { +sexp_t *copy_sexp(sexp_mem_t *smem, sexp_t *s) { sexp_t *snew; if (s == NULL) return NULL; - snew = sexp_t_allocate(); + snew = sexp_t_allocate(smem); assert(snew != NULL); snew->ty = s->ty; @@ -143,11 +143,11 @@ strcpy(snew->val,s->val); snew->list = NULL; } else { - snew->list = copy_sexp(s->list); + snew->list = copy_sexp(smem, s->list); } snew->line = s->line; - snew->next = copy_sexp(s->next); + snew->next = copy_sexp(smem, s->next); return snew; } @@ -156,31 +156,31 @@ * Cons: Concatenate two s-expressions together, without references to the * originals. */ -sexp_t *cons_sexp(sexp_t *r, sexp_t *l) { +sexp_t *cons_sexp(sexp_mem_t *smem, sexp_t *r, sexp_t *l) { sexp_t *cr, *cl, *t; - cr = copy_sexp(r); + cr = copy_sexp(smem, r); if (cr->ty == SEXP_VALUE) { fprintf(stderr,"Cannot cons non-lists.\n"); - destroy_sexp(cr); + destroy_sexp(smem, cr); return NULL; } else { t = cr->list; while (t != NULL && t->next != NULL) t = t->next; } - cl = copy_sexp(l); + cl = copy_sexp(smem, l); if (cl->ty == SEXP_LIST) { if (t != NULL && cl != NULL) { t->next = cl->list; /* free(cl); */ /* memory leak fix: SMJ, 4/24/2002 */ - sexp_t_deallocate(cl); + sexp_t_deallocate(smem, cl); } } else { fprintf(stderr,"Cannot cons non-lists.\n"); - destroy_sexp(cr); - destroy_sexp(cl); + destroy_sexp(smem, cr); + destroy_sexp(smem, cl); return NULL; } @@ -190,7 +190,7 @@ /** * car: similar to head, except this is a copy and not just a reference. */ -sexp_t *car_sexp(sexp_t *s) { +sexp_t *car_sexp(sexp_mem_t *smem, sexp_t *s) { sexp_t *cr, *ocr; /* really dumb - calling on null */ @@ -206,14 +206,14 @@ } /* ocr = (sexp_t *)malloc(sizeof(sexp_t));*/ - ocr = sexp_t_allocate(); + ocr = sexp_t_allocate(smem); assert(ocr != NULL); ocr->ty = SEXP_LIST; ocr->next = NULL; /* allocate the new sexp_t */ /* cr = (sexp_t *)malloc(sizeof(sexp_t)); */ - cr = sexp_t_allocate(); + cr = sexp_t_allocate(smem); assert(cr != NULL); ocr->list = cr; @@ -226,7 +226,7 @@ } else { cr->ty = SEXP_LIST; cr->next = NULL; - cr->list = copy_sexp(s->list->list); + cr->list = copy_sexp(smem, s->list->list); } return ocr; @@ -235,7 +235,7 @@ /** * cdr: similar to tail, except this is a copy and not just a reference. */ -sexp_t *cdr_sexp(sexp_t *s) { +sexp_t *cdr_sexp(sexp_mem_t *smem, sexp_t *s) { sexp_t *cd; /* really dumb */ @@ -251,12 +251,12 @@ } /* cd = (sexp_t *)malloc(sizeof(sexp_t)); */ - cd = sexp_t_allocate(); + cd = sexp_t_allocate(smem); assert(cd != NULL); cd->ty = SEXP_LIST; cd->next = NULL; - cd->list = copy_sexp(s->list->next); + cd->list = copy_sexp(smem, s->list->next); cd->line = s->line; return cd; } Modified: trunk/spark/utility/sfsexp/sexp_ops.h =================================================================== --- trunk/spark/utility/sfsexp/sexp_ops.h 2011-03-25 22:43:15 UTC (rev 263) +++ trunk/spark/utility/sfsexp/sexp_ops.h 2011-03-26 02:16:36 UTC (rev 264) @@ -47,22 +47,22 @@ /*========*/ /* MACROS */ /*========*/ - + /** * Return the head of a list \a s by reference, not copy. */ #define hd_sexp(s) ((s)->list) - + /** * Return the tail of a list \a s by reference, not copy. */ -#define tl_sexp(s) ((s)->list->next) - +#define tl_sexp(s) ((s)->list->next) + /** * Return the element following the argument \a s. */ #define next_sexp(s) ((s)->next) - + /** * Reset the continuation \a c by setting the \c lastPos pointer to * \c NULL. @@ -71,11 +71,11 @@ /** * Find an atom in a sexpression data structure and return a pointer to - * it. Return NULL if the string doesn't occur anywhere as an atom. + * it. Return NULL if the string doesn't occur anywhere as an atom. * This is a depth-first search algorithm. */ sexp_t *find_sexp(char *name, sexp_t *start); - + /** * Breadth first search for s-expressions. Depth first search will find * the first occurance of a string in an s-expression by basically finding @@ -93,30 +93,30 @@ * to the end of the ->next linked list from that point. */ int sexp_list_length(sexp_t *sx); - + /** * Copy an s-expression. This is a deep copy - so the resulting s-expression * shares no pointers with the original. The new one can be changed without * damaging the contents of the original. */ - sexp_t *copy_sexp(sexp_t *s); - + sexp_t *copy_sexp(sexp_mem_t *smem, sexp_t *s); + /** * Cons: Concatenate two s-expressions together, without references to the * originals. */ - sexp_t *cons_sexp(sexp_t *r, sexp_t *l); - + sexp_t *cons_sexp(sexp_mem_t *smem, sexp_t *r, sexp_t *l); + /** * car: Like hd(), but returning a copy of the head, not a reference to it. */ - sexp_t *car_sexp(sexp_t *s); - + sexp_t *car_sexp(sexp_mem_t *smem, sexp_t *s); + /** * cdr: Like tl(), but returning a copy of the tail, not a reference to it. */ - sexp_t *cdr_sexp(sexp_t *s); - + sexp_t *cdr_sexp(sexp_mem_t *smem, sexp_t *s); + #ifdef __cplusplus } #endif This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <he...@us...> - 2011-03-27 21:48:03
|
Revision: 265 http://simspark.svn.sourceforge.net/simspark/?rev=265&view=rev Author: hedayat Date: 2011-03-27 21:47:57 +0000 (Sun, 27 Mar 2011) Log Message: ----------- * Fixed log player running issues Modified Paths: -------------- trunk/spark/ChangeLog trunk/spark/plugin/sparkmonitor/sparkmonitorlogfileserver.cpp trunk/spark/plugin/sparkmonitor/sparkmonitorlogfileserver.h trunk/spark/plugin/sparkmonitor/sparkmonitorlogfileserver_c.cpp trunk/spark/spark/spark.rb Modified: trunk/spark/ChangeLog =================================================================== --- trunk/spark/ChangeLog 2011-03-26 02:16:36 UTC (rev 264) +++ trunk/spark/ChangeLog 2011-03-27 21:47:57 UTC (rev 265) @@ -1,3 +1,25 @@ +2011-03-28 Hedayat Vatankhah <hed...@gm...> + + * plugin/sparkmonitor/sparkmonitorlogfileserver.cpp + (SparkMonitorLogFileServer::StartCycle): + - don't do anything in StartCycle() before time 0.1. it is a workaround a + random crash which might be because of some kind of initialization delay + + * spark/spark.rb: + - set adjust speed mode for both monitor and log player to prevent + waisting any time trying to catch up in physics update (which they don't + have at all)! + +2011-03-27 Hedayat Vatankhah <hed...@gm...> + + * plugin/sparkmonitor/sparkmonitorlogfileserver.h: + * plugin/sparkmonitor/sparkmonitorlogfileserver.cpp: + * plugin/sparkmonitor/sparkmonitorlogfileserver_c.cpp: + - call mActiveScene's SetModified() and UpdateCache() so that it shows the + field again + - remove mStepDelay, it is not needed as the timing is controlled by the + simulation server + 2011-03-26 Hedayat Vatankhah <hed...@gm...> * plugin/sexpparser/sexpparser.h: Modified: trunk/spark/plugin/sparkmonitor/sparkmonitorlogfileserver.cpp =================================================================== --- trunk/spark/plugin/sparkmonitor/sparkmonitorlogfileserver.cpp 2011-03-26 02:16:36 UTC (rev 264) +++ trunk/spark/plugin/sparkmonitor/sparkmonitorlogfileserver.cpp 2011-03-27 21:47:57 UTC (rev 265) @@ -42,7 +42,6 @@ { mPause = false; mForwardStep = false; - mStepDelay = 0; mBackwardPlayback = false; mSexpMemory = init_sexp_memory(); } @@ -112,6 +111,9 @@ void SparkMonitorLogFileServer::StartCycle() { + // work around a random crash! + if (GetTime() < 0.1) + return; if (mPause && !mForwardStep) { @@ -139,12 +141,6 @@ ParseMessage(msg); } -#ifdef WIN32 - Sleep(mStepDelay / 1000); -#else - usleep(mStepDelay); -#endif - mForwardStep = false; } @@ -229,6 +225,7 @@ } mActiveScene = mSceneServer->GetActiveScene(); + mActiveScene->UpdateCache(); if (mActiveScene.get() == 0) { @@ -271,6 +268,7 @@ mSceneImporter->ParseScene(string(pcont->lastPos), mManagedScene, boost::shared_ptr<ParameterList>()); + mActiveScene->SetModified(true); destroy_sexp(mSexpMemory, sexp_custom); destroy_continuation(mSexpMemory, pcont); Modified: trunk/spark/plugin/sparkmonitor/sparkmonitorlogfileserver.h =================================================================== --- trunk/spark/plugin/sparkmonitor/sparkmonitorlogfileserver.h 2011-03-26 02:16:36 UTC (rev 264) +++ trunk/spark/plugin/sparkmonitor/sparkmonitorlogfileserver.h 2011-03-27 21:47:57 UTC (rev 265) @@ -62,9 +62,6 @@ /** backward play the log file back */ void BackwardPlayback(); - /** set the length of delay between steps */ - void SetStepDelay(int delay){ mStepDelay = delay; } - protected: /** parses a received message */ void ParseMessage(const std::string& msg); @@ -107,9 +104,6 @@ /** line numbers storage */ std::stack<unsigned> linePositions; - /** the length of delay between seteps */ - int mStepDelay; - bool mBackwardPlayback; /** cached reference to the script server */ Modified: trunk/spark/plugin/sparkmonitor/sparkmonitorlogfileserver_c.cpp =================================================================== --- trunk/spark/plugin/sparkmonitor/sparkmonitorlogfileserver_c.cpp 2011-03-26 02:16:36 UTC (rev 264) +++ trunk/spark/plugin/sparkmonitor/sparkmonitorlogfileserver_c.cpp 2011-03-27 21:47:57 UTC (rev 265) @@ -40,25 +40,9 @@ return true; } -FUNCTION(SparkMonitorLogFileServer, setStepDelay) -{ - int inDelay; - - if ( - (in.GetSize() != 1) || - (! in.GetValue(in[0], inDelay)) - ) - { - return false; - } - - obj->SetStepDelay(inDelay); - return true; -} - FUNCTION(SparkMonitorLogFileServer, pauseMode) { - if (in.GetSize() != 0) + if (in.GetSize() != 0) { return false; } @@ -69,7 +53,7 @@ FUNCTION(SparkMonitorLogFileServer, stepForward) { - if (in.GetSize() != 0) + if (in.GetSize() != 0) { return false; } @@ -80,7 +64,7 @@ FUNCTION(SparkMonitorLogFileServer, stepBackward) { - if (in.GetSize() != 0) + if (in.GetSize() != 0) { return false; } @@ -91,7 +75,7 @@ FUNCTION(SparkMonitorLogFileServer, playBackward) { - if (in.GetSize() != 0) + if (in.GetSize() != 0) { return false; } @@ -109,5 +93,4 @@ DEFINE_FUNCTION(stepForward); DEFINE_FUNCTION(stepBackward); DEFINE_FUNCTION(playBackward); - DEFINE_FUNCTION(setStepDelay); } Modified: trunk/spark/spark/spark.rb =================================================================== --- trunk/spark/spark/spark.rb 2011-03-26 02:16:36 UTC (rev 264) +++ trunk/spark/spark/spark.rb 2011-03-27 21:47:57 UTC (rev 265) @@ -198,6 +198,10 @@ simulationServer = sparkGetSimulationServer() if (simulationServer != nil) simulationServer.setMultiThreads(false) + + # set auto speed adjust mode. + simulationServer.setAdjustSpeed(true) + simulationServer.setMaxStepsPerCyle(1) end monitorClient = sparkCreate('SparkMonitorClient', $serverPath+'simulation/SparkMonitorClient') @@ -229,6 +233,10 @@ if (simulationServer != nil) simulationServer.setMultiThreads(false) + # set auto speed adjust mode. + simulationServer.setAdjustSpeed(true) + simulationServer.setMaxStepsPerCyle(1) + monitorClient = sparkCreate('SparkMonitorLogFileServer', $serverPath+'simulation/SparkMonitorLogFileServer') monitorClient.setFileName($logPlayerFile) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <he...@us...> - 2011-04-20 23:14:41
|
Revision: 267 http://simspark.svn.sourceforge.net/simspark/?rev=267&view=rev Author: hedayat Date: 2011-04-20 23:14:35 +0000 (Wed, 20 Apr 2011) Log Message: ----------- Add support for providing alternative ode-config binaries, useful when multiple version of ODE is installed on the system Modified Paths: -------------- trunk/spark/ChangeLog trunk/spark/cmake/FindODE.cmake Modified: trunk/spark/ChangeLog =================================================================== --- trunk/spark/ChangeLog 2011-03-27 22:01:34 UTC (rev 266) +++ trunk/spark/ChangeLog 2011-04-20 23:14:35 UTC (rev 267) @@ -1,3 +1,9 @@ +2011-04-20 Hedayat Vatankhah <hed...@gm...> + + * cmake/FindODE.cmake: + - ODE_CONFIG_EXEC variable can be used to specify alternative ode-config + executable + 2011-03-28 Hedayat Vatankhah <hed...@gm...> * plugin/sparkmonitor/sparkmonitorlogfileserver.cpp Modified: trunk/spark/cmake/FindODE.cmake =================================================================== --- trunk/spark/cmake/FindODE.cmake 2011-03-27 22:01:34 UTC (rev 266) +++ trunk/spark/cmake/FindODE.cmake 2011-04-20 23:14:35 UTC (rev 267) @@ -8,7 +8,7 @@ IF (NOT ODE_FOUND) - FIND_PROGRAM(ODE_CONFIG ode-config) + FIND_PROGRAM(ODE_CONFIG NAMES ${ODE_CONFIG_EXEC} ode-config) IF(ODE_CONFIG) # Use the newer EXECUTE_PROCESS command if it is available. IF(COMMAND EXECUTE_PROCESS) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <he...@us...> - 2011-04-21 15:29:31
|
Revision: 270 http://simspark.svn.sourceforge.net/simspark/?rev=270&view=rev Author: hedayat Date: 2011-04-21 15:29:25 +0000 (Thu, 21 Apr 2011) Log Message: ----------- Do not block on sending data to clients over network! Modified Paths: -------------- trunk/spark/ChangeLog trunk/spark/NEWS trunk/spark/RELEASE trunk/spark/lib/oxygen/simulationserver/netcontrol.cpp trunk/spark/lib/oxygen/simulationserver/netcontrol.h Modified: trunk/spark/ChangeLog =================================================================== --- trunk/spark/ChangeLog 2011-04-21 13:55:47 UTC (rev 269) +++ trunk/spark/ChangeLog 2011-04-21 15:29:25 UTC (rev 270) @@ -1,3 +1,13 @@ +2011-04-21 Hedayat Vatankhah <hed...@gm...> + + * NEWS: + * RELEASE: + - Added info about the network change for 0.2.2 release + + * lib/oxygen/simulationserver/netcontrol.cpp (NetControl::SendClientMessage): + - don't block on sending data to agents. if a receiver cannot receive data, + it'll lose future messages until it can receive furthur messages + 2011-04-20 Hedayat Vatankhah <hed...@gm...> * cmake/FindODE.cmake: Modified: trunk/spark/NEWS =================================================================== --- trunk/spark/NEWS 2011-04-21 13:55:47 UTC (rev 269) +++ trunk/spark/NEWS 2011-04-21 15:29:25 UTC (rev 270) @@ -15,6 +15,8 @@ - HingePerceptor can report torque - Better Performance - New timing system result in more cleaner code and prevent wasting CPU time +- Do not block on sending data to clients. Previously, simulator would block on + send() until it can send all data to clients. [0.2.1] This release of simspark is prepared for RoboCup 2010 competitions in Singapore. Modified: trunk/spark/RELEASE =================================================================== --- trunk/spark/RELEASE 2011-04-21 13:55:47 UTC (rev 269) +++ trunk/spark/RELEASE 2011-04-21 15:29:25 UTC (rev 270) @@ -16,6 +16,8 @@ - HingePerceptor can report torque - Better Performance - New timing system result in more cleaner code and prevent wasting CPU time +- Do not block on sending data to clients. Previously, simulator would block on + send() until it can send all data to clients. You can get the package on the Simspark page on SourceForge at http://sourceforge.net/projects/simspark/ Modified: trunk/spark/lib/oxygen/simulationserver/netcontrol.cpp =================================================================== --- trunk/spark/lib/oxygen/simulationserver/netcontrol.cpp 2011-04-21 13:55:47 UTC (rev 269) +++ trunk/spark/lib/oxygen/simulationserver/netcontrol.cpp 2011-04-21 15:29:25 UTC (rev 270) @@ -253,6 +253,7 @@ << endl; mClientId++; + mSendBuffers.resize(mClientId); ClientConnect(client); } @@ -318,12 +319,33 @@ // udp client if (mSocket.get() != 0) { - rval = mSocket->send(msg.data(), msg.size(), client->addr); + do + { + rval = mSocket->send(msg.data(), msg.size(), + client->addr, rcss::net::Socket::DONT_CHECK); + } + while (rval == -1 && errno == EINTR); + // don't retry unless an interrupt is received } } else { // tcp client - rval = socket->send(msg.data(), msg.size()); + const string &sendMsg = mSendBuffers[client->id].empty() ? msg + : mSendBuffers[client->id]; + unsigned sent = 0; + do + { + rval = socket->send(sendMsg.data() + sent, + sendMsg.size() - sent, 0, + rcss::net::Socket::DONT_CHECK); + if ( rval > 0 ) + sent += rval; + } + while (sent < sendMsg.size() && (rval != -1 || errno == EINTR)); + // try to send unless an EINTR error happens + + mSendBuffers[client->id].assign(sendMsg.data() + sent, + sendMsg.size() - sent); } if (rval < 0) Modified: trunk/spark/lib/oxygen/simulationserver/netcontrol.h =================================================================== --- trunk/spark/lib/oxygen/simulationserver/netcontrol.h 2011-04-21 13:55:47 UTC (rev 269) +++ trunk/spark/lib/oxygen/simulationserver/netcontrol.h 2011-04-21 15:29:25 UTC (rev 270) @@ -22,6 +22,7 @@ #include "simcontrolnode.h" #include "netbuffer.h" +#include <vector> #include <rcssnet/socket.hpp> #include <boost/shared_array.hpp> #include <oxygen/oxygen_defines.h> @@ -198,6 +199,9 @@ /** the size of the allocated receive buffer */ int mBufferSize; + /** a buffer to store partial messages to be sent */ + std::vector<std::string> mSendBuffers; + /** the receive buffer */ boost::shared_array<char> mBuffer; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |