Gazebo | Ignition | Community
Ask Your Question
0

Why does the spring joint plugin not work?

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

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();
                                             ^~~~~~~~
                                             GetForce

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
1

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

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

Comments

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

kumpakri gravatar imagekumpakri ( 2018-12-10 04:06:51 -0600 )edit

Question Tools

1 follower

Stats

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

Seen: 1,286 times

Last updated: Dec 06 '18