Gazebo | Ignition | Community
Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Why can't I set PID gains through JointController?

Hello,

When I set the gains of my PID object using a direct reference it works, as :

common::PID pid = common::PID(0.1, 0, 0);
std::cout << pid.GetPGain();

pid.SetPGain(0.5);
std::cout << pid.GetPGain();

produces

0.1
0.5

However, when I access it through the joint controller, the gain value isn't set.

std::cout << model->GetJointController()->GetPositionPIDs()[joint->GetScopedName()]->GetPGain();

model->GetJointController()->GetPositionPIDs()[joint->GetScopedName()]->SetPGain(0.5);

std::cout << model->GetJointController()->GetPositionPIDs()[joint->GetScopedName()]->GetPGain();

produces

0.1
0.1

Does GetPositionPIDs not provide you with the actual PID objects, but a bunch of copies?

Cheers,