Revision history [back]

Hi,

I'm not 100% sure, but I think this function might use default PIDs to set joints positions. I think the proper way to do what you want is to use directly these PIDs (or yours):

// Get the default PIDs attached to your joints
this->jointController = this->model->GetJointController()

// In a loop, on your joints
// Create a PID
gazebo::common::PID PID = gazebo::common::PID(p,i,d,imax,imin,cmdMax,cmdMin);
// Set the PID to your joint (pay attention to joint name and scopedName)
this->jointController->SetPositionPID((*it)->GetScopedName(),PID);
// Set target
this->jointController->SetPositionTarget((*it)->GetScopedName(), target);

// Update the controller
this->jointController->Update();


Here is the doc: https://osrf-distributions.s3.amazonaws.com/gazebo/api/dev/classgazebo_1_1physics_1_1JointController.html