ODECollision.hh
00001 /*
00002  * Copyright 2011 Nate Koenig & Andrew Howard
00003  *
00004  * Licensed under the Apache License, Version 2.0 (the "License");
00005  * you may not use this file except in compliance with the License.
00006  * You may obtain a copy of the License at
00007  *
00008  *     http://www.apache.org/licenses/LICENSE-2.0
00009  *
00010  * Unless required by applicable law or agreed to in writing, software
00011  * distributed under the License is distributed on an "AS IS" BASIS,
00012  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
00013  * See the License for the specific language governing permissions and
00014  * limitations under the License.
00015  *
00016 */
00017 /* Desc: Collision class
00018  * Author: Nate Koenig
00019  * Date: 13 Feb 2006
00020  */
00021 
00022 #ifndef ODECOLLISION_HH
00023 #define ODECOLLISION_HH
00024 
00025 #include "ode/ode.h"
00026 
00027 #include "common/CommonTypes.hh"
00028 
00029 #include "physics/PhysicsTypes.hh"
00030 #include "physics/Collision.hh"
00031 
00032 namespace gazebo
00033 {
00034     namespace physics
00035   {
00038     
00041 
00043     class ODECollision : public Collision
00044     {
00046       public: ODECollision(LinkPtr link);
00047     
00049       public: virtual ~ODECollision();
00050   
00052       public: virtual void Load( sdf::ElementPtr &_sdf );
00053 
00054       /*public: virtual void Load()
00055               {
00056                 Base::Load();
00057               }
00058               */
00059 
00061       public: void Fini();
00062  
00064       public: void SetCollision(dGeomID collisionId, bool placeable);
00065     
00068       public: dGeomID GetCollisionId() const;
00069     
00071       public: int GetCollisionClass() const;
00072     
00073       public: virtual void OnPoseChange();
00074   
00077       public: virtual void SetCategoryBits(unsigned int bits);
00078     
00081       public: virtual void SetCollideBits(unsigned int bits);
00082     
00084       public: virtual math::Box GetBoundingBox() const;
00085   
00087       public: dSpaceID GetSpaceId() const;
00088   
00090       public: void SetSpaceId(dSpaceID spaceid);
00091   
00092       private: void OnPoseChangeGlobal();
00093       private: void OnPoseChangeRelative();
00094       private: void OnPoseChangeNull();
00095 
00096       protected: dSpaceID spaceId;
00097   
00099       protected: dGeomID collisionId;
00100 
00101       private: void (ODECollision::*onPoseChangeFunc)();
00102     };
00103   
00106   
00107   }
00108 }
00109 #endif