SetMaxForce deprecated in gazebo 5.0
Hi,
In Gazebo 5.0 when using physics::Joint::SetMaxForce
I got this warning :
virtual void gazebo::physics::Joint::SetMaxForce(unsigned int, double)’ is deprecated (declared at /usr/include/gazebo-5.0/gazebo/physics/Joint.hh:365) [-Wdeprecated-declarations] joints[i]->SetMaxForce(0, 1.0);
And when I remove it and use only Joint::SetVelocity
the robot starts to do random moves and fly even with 0.1 rad/s
How to fix this ?
UP DATE
here is the source code
#include <boost/bind.hpp>
#include <gazebo/gazebo.hh>
#include <gazebo/physics/physics.hh>
#include <gazebo/common/common.hh>
#include <stdio.h>
namespace gazebo
{
class SetJoints : public ModelPlugin
{
public: void Load(physics::ModelPtr _parent, sdf::ElementPtr /*_sdf*/)
{
this->model = _parent;
this->updateConnection = event::Events::ConnectWorldUpdateBegin(
boost::bind(&SetJoints::OnUpdate, this, _1));
}
public: void OnUpdate(const common::UpdateInfo & /*_info*/)
{
//this->model->GetJoint("my_joint")->SetParam("fmax", 2, 1.1);
//this->model->GetJoint("my_joint")->SetParam("vel", 2,6.0 );
this->model->GetJoint("my_joint")->SetMaxForce(2,1);
this->model->GetJoint("my_joint")->SetVelocity(2,4);
}
private: physics::ModelPtr model;
private: event::ConnectionPtr updateConnection;
};
GZ_REGISTER_MODEL_PLUGIN(SetJoints)
}
Just moving my comment up here— I'm not sure what the answer is, but I'm seeing a similar result with the Jackal simulator: URDF which once worked with Gazebo 2 is now flying all over the place on Gazebo 5. cf. http://answers.gazebosim.org/question/8994/jackal-simulator-flipping-and-flying-in-gazebo-51/