UniversalJoint.hh
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2012-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 #ifndef _GAZEBO_UNIVERSALJOINT_HH_
18 #define _GAZEBO_UNIVERSALJOINT_HH_
19 
20 #include "gazebo/math/Vector3.hh"
21 #include "gazebo/physics/Joint.hh"
22 #include "gazebo/util/system.hh"
23 
24 namespace gazebo
25 {
26  namespace physics
27  {
30 
35  template<class T>
37  {
40  public: enum AxisIndex
41  {
42  AXIS_PARENT = 0,
43  AXIS_CHILD = 1
44  };
45 
48  public: explicit UniversalJoint(BasePtr _parent) : T(_parent)
49  {this->AddType(Base::UNIVERSAL_JOINT);}
50 
52  public: virtual ~UniversalJoint()
53  { }
54 
55  // Documentation inherited.
56  public: virtual unsigned int GetAngleCount() const
57  {return 2;}
58 
61  public: virtual void Load(sdf::ElementPtr _sdf)
62  {
63  T::Load(_sdf);
64 
65  /*
66  this->SetAxis(0,
67  this->sdf->GetElement("axis")->Get<math::Vector3("xyz"));
68  this->SetAxis(1,
69  this->sdf->GetElement("axis2")->Get<math::Vector3>("xyz"));
70  */
71  }
72 
74  protected: virtual void Init()
75  {
76  T::Init();
77  }
78  };
80  }
81 }
82 #endif
boost::shared_ptr< Base > BasePtr
Definition: PhysicsTypes.hh:68
#define GZ_PHYSICS_VISIBLE
Definition: system.hh:318
UniversalJoint(BasePtr _parent)
Constructor.
Definition: UniversalJoint.hh:48
AxisIndex
Definition: UniversalJoint.hh:40
virtual void Init()
Initialize joint.
Definition: UniversalJoint.hh:74
virtual unsigned int GetAngleCount() const
Definition: UniversalJoint.hh:56
virtual ~UniversalJoint()
Destuctor.
Definition: UniversalJoint.hh:52
GAZEBO_VISIBLE void Init(google::protobuf::Message &_message, const std::string &_id="")
Initialize a message.
A universal joint.
Definition: UniversalJoint.hh:36
UniversalJoint type.
Definition: Base.hh:115
virtual void Load(sdf::ElementPtr _sdf)
Load a UniversalJoint.
Definition: UniversalJoint.hh:61