21 pid.
max_value = torqueConfigData->pid_max_value;
22 pid.
min_value = torqueConfigData->pid_min_value;
23 pid.
dis = torqueConfigData->pid_dis;
24 pid.
Kd = torqueConfigData->Kd;
25 pid.
inertia = torqueConfigData->inertia;
26 pid.
scalePI = torqueConfigData->scalePI;
28 pid.
maxTorque = torqueConfigData->maxTorque;
31 0.1744f, 0.0205f, 0.0215f, 0.0225f, 0.0235f, 0.0244f, 0.0252f,
32 0.0259f, 0.0265f, 0.0270f, 0.0274f, 0.0276f, 0.0278f, 0.0282f,
33 0.0282f, 0.0278f, 0.0276f, 0.0274f, 0.0270f, 0.0265f, 0.0259f,
34 0.0252f, 0.0244f, 0.0235f, 0.0225f, 0.0215f, 0.0205f, 0.1744f});
74 double er0 = (Kp + (
dt * Ki) + (
Kd /
dt)) * curr_error;
77 double delta = (er0 + er1 + er2);
124 return std::make_shared<TorqueControllerConfiguration>(configData);
135 const std::string& jointName,
139 float actualVelocity,
140 float actualPosition)
144 double dt = timeSinceLastIteration.toSecondsDouble();
148 float actualTorqueF =
149 filter.
update(actualTorque);
150 Kd = (-gravity + targetTorque + actualTorqueF) /
167 (-0.003721 * std::pow(Kd, 2.0) + 0.43429 * Kd - 1.4408) * (scalePI * 0.45);
188 (-gravity + targetTorque - Kd * actualVelocity);
197 float current = -(pid.
control) * 1000.0;
207 double pushbackMargin = 5.0 / 180. *
M_PI;
208 double pushBackTorque = 100;
210 double jointLimitProtection = 0;
211 if (!configData->limitless)
213 double borderHigh = configData->jointLimitHigh - pushbackMargin;
214 double borderLow = configData->jointLimitLow + pushbackMargin;
215 double penetration = 0;
216 if (actualPosition > borderHigh)
218 penetration = actualPosition - borderHigh;
220 else if (actualPosition < borderLow)
222 penetration = actualPosition - borderLow;
224 jointLimitProtection = penetration / pushbackMargin * pushBackTorque;
227 return jointLimitProtection;