ScrewJoint.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 _SCREWJOINT_HH_
18 #define _SCREWJOINT_HH_
19 
20 #include "gazebo/physics/Joint.hh"
21 #include "gazebo/common/Console.hh"
22 #include "gazebo/util/system.hh"
23 
24 namespace gazebo
25 {
26  namespace physics
27  {
30 
33  template<class T>
34  class GAZEBO_VISIBLE ScrewJoint : public T
35  {
38  public: explicit ScrewJoint(BasePtr _parent) : T(_parent), threadPitch(0)
39  {this->AddType(Base::SCREW_JOINT);}
40 
42  public: virtual ~ScrewJoint()
43  { }
44 
45  // Documentation inherited.
46  public: virtual unsigned int GetAngleCount() const
47  {return 2;}
48 
51  public: virtual void Load(sdf::ElementPtr _sdf)
52  {
53  T::Load(_sdf);
54 
55  this->threadPitch =
56  _sdf->GetElement("thread_pitch")->Get<double>();
57  }
58 
68  public: virtual void SetThreadPitch(double _threadPitch) = 0;
69 
75  public: virtual double GetThreadPitch() = 0;
76 
78  protected: double threadPitch;
79 
81  protected: virtual void Init()
82  {
83  T::Init();
84  }
85  };
87  }
88 }
89 #endif
boost::shared_ptr< Base > BasePtr
Definition: PhysicsTypes.hh:66
double threadPitch
Pitch of the thread.
Definition: ScrewJoint.hh:78
virtual ~ScrewJoint()
Destructor.
Definition: ScrewJoint.hh:42
ScrewJoint type.
Definition: Base.hh:107
A screw joint, which has both prismatic and rotational DOFs.
Definition: ScrewJoint.hh:34
virtual void Init()
Initialize joint.
Definition: ScrewJoint.hh:81
virtual void Load(sdf::ElementPtr _sdf)
Load a ScrewJoint.
Definition: ScrewJoint.hh:51
virtual unsigned int GetAngleCount() const
Definition: ScrewJoint.hh:46
GAZEBO_VISIBLE void Init(google::protobuf::Message &_message, const std::string &_id="")
Initialize a message.
ScrewJoint(BasePtr _parent)
Constructor.
Definition: ScrewJoint.hh:38
#define GAZEBO_VISIBLE
Use to represent "symbol visible" if supported.
Definition: system.hh:48