Gazebo | Ignition | Community
Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Why does the spring joint plugin not work?

I followed the example here and created a model plugin, that at each update call this function:

  void SpringJointPlugin::OnUpdate()
    this->current_angle = this->joint_ptr_->GetAngle(0).Radian();
    this->joint_ptr_->SetForce( 0, (this->rest_angle-this->current_angle)*this->stiffness);

the joint_ptr_ is of physics::JointPtr format. When I try to build this plugin, I get error error: ‘class gazebo::physics::Joint’ has no member named ‘GetAngle’; did you mean ‘GetForce’?
     this->current_angle = this->joint_ptr_->GetAngle(0).Radian();

When I look into the documentation, this method is listed. When I use the the GetForce method as suggested, or any other function listed in the documentation, it still gives me errors.

Why and how to fix this?