Gazebo | Ignition | Community
Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version


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)
// Set target
this->jointController->SetPositionTarget((*it)->GetScopedName(), target);

// Update the controller

Here is the doc: