00001 #ifndef ServerBase_h 00002 #define ServerBase_h 1 00003 00004 #include <CollisionDetectors/collisionDetectorType.h> 00005 #include <planners/plannerType.h> 00006 #include "kinematics/Configuration.h" 00007 #include "CollisionDetectors/CD_Vcollide.h" 00008 #include "Paths/PathBase.h" 00009 #include "OpenGL/GL_Universe.h" 00010 #include "Planners/PL_HasCollisionDetector.h" 00011 #include "smoothers/smootherType.h" 00012 #include "smoothers/SmootherBase.h" 00013 00014 class CD_BasicStyle; 00015 class DH_Link; 00016 class IfstreamWithComments; 00017 class ObjectBase; 00018 class PL_Juan; 00019 class PL_Sequential; 00020 class R_OpenChain; 00021 class SM_Midpoint; 00022 class VRML_20_Reader; 00023 class VRML_Reader; 00024 00025 class ServerBase 00026 { 00027 public: 00028 ServerBase (); 00029 virtual ~ServerBase(); 00030 00031 //sets the root path for loading files 00032 void SetRootPath( const char* path ); 00033 void SetMPKWorkingDirectory( const char* path ); 00034 00035 //## Other Operations (specified) 00036 //## Operation: R_ThreeCylinderRobot%932600045 00037 void R_ThreeCylinderRobot (); 00038 00039 //opens up an entire saved example 00040 bool OpenExampleFile( const char* filename ); 00041 //Save an entire example 00042 bool SaveExampleFile( const char* filename ); 00043 00044 //## Operation: ParseRobotFile%935034310 00045 bool ParseRobotFile (const char* filename); 00046 00047 //## Operation: ParseRobotOpenChain%935084508 00048 void ParseRobotOpenChain (IfstreamWithComments& is); 00049 00050 //## Operation: ParseObstacleFile%936229638 00051 bool ParseObstacleFile (const char* filename); 00052 00053 //## Operation: SetCollisionDetector%950474924 00054 bool SetCollisionDetector (CollisionDetectorType collisionDetectorType); 00055 00056 //## Operation: RefreshCollisionDetector%950474925 00057 // Refreshes the collision detector under the assumption 00058 // that some of the geometry in the universe has changed 00059 bool RefreshCollisionDetector (); 00060 00061 //## Operation: RefreshRobotFile%950480128 00062 bool RefreshRobotFile (); 00063 00064 //## Operation: GetRobot%950480129 00065 const RobotBase* GetRobot (const char* const filename) const; 00066 00067 //## Operation: GetMPKObject%950480130 00068 const ObjectBase* GetMPKObject (const char* const filename) const; 00069 00070 //## Operation: GetFrame%950480131 00071 const Frame GetFrame (const char* const name) const; 00072 00073 //## Operation: SetPlanner%958847982 00074 // sets the planner that this server object will use by 00075 // default. the return value should be checked and 00076 // respected. 00077 bool SetPlanner (PlannerType plannerType); 00078 00079 //## Operation: RefreshPlanner%958847983 00080 // Refreshes the planner. This assumes that the collision 00081 // detector has changed. 00082 bool RefreshPlanner (); 00083 00084 //## Operation: GetPlannerType%958953409 00085 // returns the type of planner that the server is currently 00086 // set to use 00087 PlannerType GetPlannerType (); 00088 00089 //## Operation: GetCollisionDetectorType%958953410 00090 // returns the type of planner that the server is currently 00091 // set to use 00092 CollisionDetectorType GetCollisionDetectorType (); 00093 00094 //Settup the smoother. 00095 bool SetSmoother (SmootherType smootherType); 00096 SmootherType GetSmootherType (); 00097 bool RefreshSmoother(); 00098 00099 //Parameter setup 00100 void *GetPlannerParameters(); 00101 bool SetPlannerParameters(const void *param); 00102 00103 bool LoadUserObstacle( const char *obsfile ); 00104 bool SaveUserObstacle( const char *obsfile ); 00105 bool AddObstacle( double x, double y ); 00106 // Data Members for Associations 00107 00108 //## Association: MPKserver::<unnamed>%379616AC0214 00109 //## Role: ServerBase::collisionDetector%379616AC03D7 00110 //## begin ServerBase::collisionDetector%379616AC03D7.role preserve=no public: CD_BasicStyle { -> 1UFHAN} 00111 CD_BasicStyle* collisionDetector; 00112 //## end ServerBase::collisionDetector%379616AC03D7.role 00113 00114 //## Association: MPKserver::<unnamed>%379616D50046 00115 //## Role: ServerBase::planner%379616D600AC 00116 //## begin ServerBase::planner%379616D600AC.role preserve=no public: PL_HasCollisionDetector { -> 1UHAN} 00117 PL_HasCollisionDetector* planner; 00118 00119 SmootherBase* smoother; 00120 //## end ServerBase::planner%379616D600AC.role 00121 00122 //## Association: MPKserver::<unnamed>%379616EA015F 00123 //## Role: ServerBase::universe%379616EA0371 00124 //## begin ServerBase::universe%379616EA0371.role preserve=no public: GL_Universe { -> 1VHAN} 00125 GL_Universe universe; 00126 //## end ServerBase::universe%379616EA0371.role 00127 00128 //## Association: MPKserver::<unnamed>%38A7194B0316 00129 //## Role: ServerBase::currentConfig%38A7194B03B7 00130 //## begin ServerBase::currentConfig%38A7194B03B7.role preserve=no public: Configuration { -> VFHAN} 00131 Configuration m_CurrentConfig; 00132 Configuration m_GoalConfig; 00133 Configuration m_StartConfig; 00134 //## end ServerBase::currentConfig%38A7194B03B7.role 00135 00136 // Additional Public Declarations 00137 //## begin ServerBase%37AB2C4702C6.public preserve=yes 00138 Vector4 m_CameraPosition; 00139 Vector4 m_CameraLookat; 00140 Vector4 m_CameraUp; 00141 Vector4 m_CspaceCameraPosition; 00142 Vector4 m_CspaceCameraLookat; 00143 Vector4 m_CspaceCameraUp; 00144 PA_Points m_Path ; 00145 const char* GetRobotFilename() const; 00146 const char* GetObstacleFilename() const; 00147 //## end ServerBase%37AB2C4702C6.public 00148 protected: 00149 void ParseCspaceCamera( IfstreamWithComments& is ); 00150 void ParseGoalFrames ( IfstreamWithComments& is ); 00151 00152 CollisionDetectorType collisionDetectorType; 00153 bool planPassed; 00154 char filename[ 256 ]; 00155 char rootpath[ 256 ]; 00156 char obstacleFilename[ 256 ]; 00157 PlannerType plannerType; 00158 SmootherType smootherType; 00159 00160 protected: 00161 std::vector<Matrix4x4> userObstacles; 00162 }; 00163 00164 //## begin ServerBase%37AB2C4702C6.postscript preserve=yes 00165 //## end ServerBase%37AB2C4702C6.postscript 00166 00167 // Class ServerBase 00168 00169 //## begin module%37AB2C4702C6.epilog preserve=yes 00170 //## end module%37AB2C4702C6.epilog 00171 00172 00173 #endif