Contact.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: Specification of a contact
00018  * Author: Nate Koenig
00019  * Date: 10 Nov 2009
00020  * SVN: $Id$
00021  */
00022 
00023 #ifndef CONTACT_HH
00024 #define CONTACT_HH
00025 
00026 #include <vector>
00027 
00028 #include "common/Time.hh"
00029 #include "math/Vector3.hh"
00030 #include "JointFeedback.hh"
00031 
00032 // For the sake of efficiency, use fixed size arrays for collision
00033 // MAX_DCOLLIDE_RETURNS limits contact detection, needs to be large
00034 //                      for proper contact dynamics.
00035 // MAX_CONTACT_JOINTS truncates <max_contacts> specified in SDF
00036 #define MAX_DCOLLIDE_RETURNS 250
00037 #define MAX_CONTACT_JOINTS 20
00038 
00039 namespace gazebo
00040 {
00041     namespace physics
00042   {
00043     class Collision;
00046    
00049     class Contact
00050     {
00052       public: Contact();
00053   
00055       public: Contact(const Contact &c);
00056   
00058       public: virtual ~Contact();
00059   
00061       public: Contact Clone() const;
00062     
00064       public: const Contact &operator=(const Contact &contact);
00065   
00067       public: void Reset();
00068     
00069       public: Collision *collision1;
00070       public: Collision *collision2;
00071    
00072       public: JointFeedback forces[MAX_CONTACT_JOINTS];
00073   
00074       public: math::Vector3 positions[MAX_CONTACT_JOINTS];
00075       public: math::Vector3 normals[MAX_CONTACT_JOINTS];
00076     
00077       public: double depths[MAX_CONTACT_JOINTS];
00078 
00079       public: int count;
00080   
00081       public: common::Time time;
00082     };
00084   }
00085 }
00086 #endif