UniversalJoint.hh
Go to the documentation of this file.
1/*
2 * Copyright (C) 2012 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
21#include "gazebo/util/system.hh"
22
23namespace gazebo
24{
25 namespace physics
26 {
29
34 template<class T>
35 class GZ_PHYSICS_VISIBLE UniversalJoint : public T
36 {
39 public: enum AxisIndex
40 {
41 AXIS_PARENT = 0,
42 AXIS_CHILD = 1
43 };
44
47 public: explicit UniversalJoint(BasePtr _parent) : T(_parent)
48 {this->AddType(Base::UNIVERSAL_JOINT);}
49
51 public: virtual ~UniversalJoint()
52 { }
53
54 // Documentation inherited.
55 public: virtual unsigned int DOF() const
56 {return 2;}
57
60 public: virtual void Load(sdf::ElementPtr _sdf)
61 {
62 T::Load(_sdf);
63
64 /*
65 this->SetAxis(0,
66 this->sdf->GetElement("axis")->Get<ignition::math::Vector3d("xyz"));
67 this->SetAxis(1,
68 this->sdf->GetElement("axis2")->Get<ignition::math::Vector3d>("xyz"));
69 */
70 }
71
73 protected: virtual void Init()
74 {
75 T::Init();
76 }
77 };
79 }
80}
81#endif
@ UNIVERSAL_JOINT
UniversalJoint type.
Definition Base.hh:104
A universal joint.
Definition UniversalJoint.hh:36
virtual void Init()
Initialize joint.
Definition UniversalJoint.hh:73
virtual ~UniversalJoint()
Destuctor.
Definition UniversalJoint.hh:51
UniversalJoint(BasePtr _parent)
Constructor.
Definition UniversalJoint.hh:47
AxisIndex
Map joint axes to corresponding link.
Definition UniversalJoint.hh:40
@ AXIS_PARENT
Definition UniversalJoint.hh:41
@ AXIS_CHILD
Definition UniversalJoint.hh:42
virtual void Load(sdf::ElementPtr _sdf)
Load a UniversalJoint.
Definition UniversalJoint.hh:60
virtual unsigned int DOF() const
Definition UniversalJoint.hh:55
boost::shared_ptr< Base > BasePtr
Definition PhysicsTypes.hh:77
Forward declarations for the common classes.
Definition Animation.hh:27