All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
DARTPhysics.hh
Go to the documentation of this file.
1 /*
2  * Copyright 2014 Open Source Robotics Foundation
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  *
16 */
17 
18 #ifndef _GAZEBO_DARTPHYSICS_HH_
19 #define _GAZEBO_DARTPHYSICS_HH_
20 
21 #include <string>
22 
23 #include <boost/thread/thread.hpp>
24 #include <boost/thread/mutex.hpp>
25 
28 #include "gazebo/physics/Shape.hh"
29 
32 
33 namespace gazebo
34 {
35  namespace physics
36  {
40 
42  class DARTPhysics : public PhysicsEngine
43  {
46  public: enum DARTParam
47  {
48  // /// \brief Solve type
49  // SOLVER_TYPE,
50 
51  // /// \brief Constraint force mixing
52  // GLOBAL_CFM,
53 
54  // /// \brief Error reduction parameter
55  // GLOBAL_ERP,
56 
57  // /// \brief Number of iterations
58  // PGS_ITERS,
59 
60  // /// \brief SOR over-relaxation parameter
61  // SOR,
62 
63  // /// \brief Surface layer depth
64  // CONTACT_SURFACE_LAYER,
65 
68 
71  };
72 
74  public: DARTPhysics(WorldPtr _world);
75 
77  public: virtual ~DARTPhysics();
78 
79  // Documentation inherited
80  public: virtual void Load(sdf::ElementPtr _sdf);
81 
82  // Documentation inherited
83  public: virtual void Init();
84 
85  // Documentation inherited
86  public: virtual void Fini();
87 
88  // Documentation inherited
89  public: virtual void Reset();
90 
91  // Documentation inherited
92  public: virtual void InitForThread();
93 
94  // Documentation inherited
95  public: virtual void UpdateCollision();
96 
97  // Documentation inherited
98  public: virtual void UpdatePhysics();
99 
100  // Documentation inherited
101  public: virtual std::string GetType() const;
102 
103  // Documentation inherited
104  public: virtual void SetSeed(uint32_t _seed);
105 
106  // Documentation inherited
107  public: virtual ModelPtr CreateModel(BasePtr _parent);
108 
109  // Documentation inherited
110  public: virtual LinkPtr CreateLink(ModelPtr _parent);
111 
112  // Documentation inherited
113  public: virtual CollisionPtr CreateCollision(const std::string &_type,
114  LinkPtr _body);
115 
116  // Documentation inherited
117  public: virtual JointPtr CreateJoint(const std::string &_type,
118  ModelPtr _parent);
119 
120  // Documentation inherited
121  public: virtual ShapePtr CreateShape(const std::string &_shapeType,
122  CollisionPtr _collision);
123 
124  // Documentation inherited
125  public: virtual void SetGravity(const gazebo::math::Vector3 &_gravity);
126 
127  // Documentation inherited
128  public: virtual void DebugPrint() const;
129 
130  // Documentation inherited
131  public: virtual boost::any GetParam(const std::string &_key) const;
132 
136  public: virtual boost::any GetParam(DARTParam _param) const;
137 
140  public: dart::simulation::World *GetDARTWorld();
141 
142  // Documentation inherited
143  protected: virtual void OnRequest(ConstRequestPtr &_msg);
144 
145  // Documentation inherited
146  protected: virtual void OnPhysicsMsg(ConstPhysicsPtr &_msg);
147 
151  private: DARTLinkPtr FindDARTLink(
152  const dart::dynamics::BodyNode *_dtBodyNode);
153 
155  private: dart::simulation::World *dtWorld;
156  };
157 
159  }
160 }
161 #endif