mirror of
https://github.com/Klipper3d/klipper.git
synced 2026-01-11 10:23:07 -07:00
Allow Tikhonov to output negative forces if requested
This commit is contained in:
parent
c7c809e4f5
commit
9bd021bd08
1 changed files with 4 additions and 2 deletions
|
|
@ -256,15 +256,17 @@ static_forces_tikhonov(struct winch_flex *wf, const struct coord *pos,
|
|||
double norm_sq = 0.;
|
||||
for (int i = 0; i < N; ++i)
|
||||
norm_sq += d[i] * d[i];
|
||||
if (norm_sq < tol * tol)
|
||||
if (norm_sq < tol * tol) {
|
||||
break;
|
||||
}
|
||||
for (int i = 0; i < N; ++i)
|
||||
T[i] -= step_damp * d[i];
|
||||
}
|
||||
|
||||
// Hard cap on Tmax and 0 if we don't ignore pretension
|
||||
// Allow negative forces if the user asked for it
|
||||
for (int i=0;i<N;++i){
|
||||
if (T[i] < 0.f) T[i] = 0.f;
|
||||
if (wf->min_force[i] >= 0. && T[i] < 0.) T[i] = 0.;
|
||||
if (T[i] > wf->max_force[i]) T[i] = wf->max_force[i];
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue