18 #ifndef _GEARBOXJOINT_HH_
19 #define _GEARBOXJOINT_HH_
47 : T(_parent), gearRatio(1.0)
54 public:
virtual unsigned int DOF()
const
59 public:
virtual void Load(sdf::ElementPtr _sdf)
62 if (_sdf->HasElement(
"gearbox_ratio"))
65 _sdf->Get<
double>(
"gearbox_ratio");
69 gzerr <<
"gearbox_ratio_not_specified, set to 1.\n";
70 this->gearRatio = 1.0;
77 if (_sdf->HasElement(
"gearbox_reference_body"))
80 _sdf->Get<std::string>(
"gearbox_reference_body");
84 gzerr <<
"Gearbox joint missing reference body.\n";
89 protected:
virtual void Init()
97 {
return this->gearRatio; }
104 public:
virtual void SetGearboxRatio(
double _gearRatio) = 0;
107 public:
virtual void FillMsg(msgs::Joint &_msg)
110 msgs::Joint::Gearbox *gearboxMsg = _msg.mutable_gearbox();
111 gearboxMsg->set_gearbox_reference_body(this->referenceBody);
112 gearboxMsg->set_gearbox_ratio(this->gearRatio);
virtual void Load(sdf::ElementPtr _sdf)
Load joint.
Definition: GearboxJoint.hh:59
std::string referenceBody
reference link/body for computing joint angles
Definition: GearboxJoint.hh:119
GearboxJoint type.
Definition: Base.hh:112
#define gzerr
Output an error message.
Definition: Console.hh:50
virtual void Init()
Initialize joint.
Definition: GearboxJoint.hh:89
A double axis gearbox joint.
Definition: GearboxJoint.hh:42
virtual ~GearboxJoint()
Destructor.
Definition: GearboxJoint.hh:50
virtual double GetGearboxRatio() const
Get gearbox joint gear ratio.
Definition: GearboxJoint.hh:96
virtual unsigned int DOF() const
Definition: GearboxJoint.hh:54
GearboxJoint(BasePtr _parent)
Constructor.
Definition: GearboxJoint.hh:46
double gearRatio
Gearbox gearRatio.
Definition: GearboxJoint.hh:116
GAZEBO_VISIBLE void Init(google::protobuf::Message &_message, const std::string &_id="")
Initialize a message.
boost::shared_ptr< Base > BasePtr
Definition: PhysicsTypes.hh:77
virtual void FillMsg(msgs::Joint &_msg)
Definition: GearboxJoint.hh:107
virtual void FillMsg(msgs::Joint &_msg)
Fill a joint message.