I was trying to move a joint with below code:
public: void Load(physics::ModelPtr _parent, sdf::ElementPtr)
{
if (_parent->GetJointCount() == 0)
{
std::cerr << "Invalid joint count,plugin not loaded\n";
return;
}
this->model = _parent;
this->pid = common::PID(0.1,0,0);
this->jointsController = boost::shared_ptr(new physics::JointController(this->model));
std::vector joints = this->model->GetJoints();
for(unsigned i=0;ijointsController->AddJoint(joints[i]);
this->jointsController->SetPositionPID(joints[i]->GetScopedName(),this->pid);
}
this->updateConnection = event::Events::ConnectWorldUpdateBegin(boost::bind(&WorldPluginTutorial::OnUpdate, this, _1));
}
public: void OnUpdate(const common::UpdateInfo &)
{
this->jointsController->SetVelocityPID(this->model->GetJoint("palm_right_finger")->GetScopedName(),10);
}
private: physics::ModelPtr model;
private: common::PID pid;
private: physics::JointControllerPtr jointsController;
private: event::ConnectionPtr updateConnection;
};
I am using [this](http://gazebosim.org/tutorials?tut=simple_gripper&cat=build_robot) robot, to test this. But when i run this code the gripper always moves very slow. What is the problem in this code, i got this code from some page and tried it.
↧