DARTPhysics.hh
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2014-2015 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 #include "gazebo/util/system.hh"
33 
34 namespace gazebo
35 {
36  namespace physics
37  {
39  class DARTPhysicsPrivate;
40 
44 
47  {
50  public: enum DARTParam
51  {
52  // /// \brief Solve type
53  // SOLVER_TYPE,
54 
55  // /// \brief Constraint force mixing
56  // GLOBAL_CFM,
57 
58  // /// \brief Error reduction parameter
59  // GLOBAL_ERP,
60 
61  // /// \brief Number of iterations
62  // PGS_ITERS,
63 
64  // /// \brief SOR over-relaxation parameter
65  // SOR,
66 
67  // /// \brief Surface layer depth
68  // CONTACT_SURFACE_LAYER,
69 
72 
74  MIN_STEP_SIZE
75  };
76 
78  public: DARTPhysics(WorldPtr _world);
79 
81  public: virtual ~DARTPhysics();
82 
83  // Documentation inherited
84  public: virtual void Load(sdf::ElementPtr _sdf);
85 
86  // Documentation inherited
87  public: virtual void Init();
88 
89  // Documentation inherited
90  public: virtual void Fini();
91 
92  // Documentation inherited
93  public: virtual void Reset();
94 
95  // Documentation inherited
96  public: virtual void InitForThread();
97 
98  // Documentation inherited
99  public: virtual void UpdateCollision();
100 
101  // Documentation inherited
102  public: virtual void UpdatePhysics();
103 
104  // Documentation inherited
105  public: virtual std::string GetType() const;
106 
107  // Documentation inherited
108  public: virtual void SetSeed(uint32_t _seed);
109 
110  // Documentation inherited
111  public: virtual ModelPtr CreateModel(BasePtr _parent);
112 
113  // Documentation inherited
114  public: virtual LinkPtr CreateLink(ModelPtr _parent);
115 
116  // Documentation inherited
117  public: virtual CollisionPtr CreateCollision(const std::string &_type,
118  LinkPtr _body);
119 
120  // Documentation inherited
121  public: virtual JointPtr CreateJoint(const std::string &_type,
122  ModelPtr _parent);
123 
124  // Documentation inherited
125  public: virtual ShapePtr CreateShape(const std::string &_shapeType,
126  CollisionPtr _collision);
127 
128  // Documentation inherited
129  public: virtual void SetGravity(const gazebo::math::Vector3 &_gravity);
130 
131  // Documentation inherited
132  public: virtual void DebugPrint() const;
133 
134  // Documentation inherited
135  public: virtual boost::any GetParam(const std::string &_key) const;
136 
137  // Documentation inherited
138  public: virtual bool GetParam(const std::string &_key,
139  boost::any &_value) const;
140 
141  // Documentation inherited
142  public: virtual bool SetParam(const std::string &_key,
143  const boost::any &_value);
144 
147  public: dart::simulation::World *GetDARTWorld();
148 
149  // Documentation inherited
150  protected: virtual void OnRequest(ConstRequestPtr &_msg);
151 
152  // Documentation inherited
153  protected: virtual void OnPhysicsMsg(ConstPhysicsPtr &_msg);
154 
158  private: DARTLinkPtr FindDARTLink(
159  const dart::dynamics::BodyNode *_dtBodyNode);
160 
163  private: DARTPhysicsPrivate *dataPtr;
164  };
165 
167  }
168 }
169 #endif
boost::shared_ptr< Base > BasePtr
Definition: PhysicsTypes.hh:68
boost::shared_ptr< Model > ModelPtr
Definition: PhysicsTypes.hh:84
#define GZ_PHYSICS_VISIBLE
Definition: system.hh:318
The Vector3 class represents the generic vector containing 3 elements.
Definition: Vector3.hh:39
boost::shared_ptr< Shape > ShapePtr
Definition: PhysicsTypes.hh:116
Base class for a physics engine.
Definition: PhysicsEngine.hh:40
DART physics engine.
Definition: DARTPhysics.hh:46
Definition: DARTPhysicsPrivate.hh:29
boost::shared_ptr< Collision > CollisionPtr
Definition: PhysicsTypes.hh:96
DART wrapper forward declarations and typedefs.
boost::shared_ptr< DARTLink > DARTLinkPtr
Definition: DARTTypes.hh:44
boost::shared_ptr< World > WorldPtr
Definition: PhysicsTypes.hh:80
boost::shared_ptr< Joint > JointPtr
Definition: PhysicsTypes.hh:100
DARTParam
DART physics parameter types.
Definition: DARTPhysics.hh:50
GAZEBO_VISIBLE void Init(google::protobuf::Message &_message, const std::string &_id="")
Initialize a message.
Maximum number of contacts.
Definition: DARTPhysics.hh:71
boost::shared_ptr< Link > LinkPtr
Definition: PhysicsTypes.hh:92