Home | Tutorials | Wiki | Issues
Ask Your Question

Why does the spring joint plugin not work?

asked 2018-12-06 08:40:41 -0500

kumpakri gravatar image

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

SpringJointPlugin.cc:80:45: 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?

edit retag flag offensive close merge delete

1 Answer

Sort by » oldest newest most voted

answered 2018-12-06 09:27:52 -0500

chapulina gravatar image

You're looking at the documentation for Gazebo 2, but I suspect you're not using that version. Take a look at the migration guide, the new function from Gazebo 8 is Joint::Position.

edit flag offensive delete link more


Is there no up-to-date documentation for Gazebo 9?

kumpakri gravatar imagekumpakri ( 2018-12-10 04:06:51 -0500 )edit
Login/Signup to Answer

Question Tools

1 follower


Asked: 2018-12-06 08:40:41 -0500

Seen: 239 times

Last updated: Dec 06 '18