Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions pyaml/tuning_tools/bba2.py
Original file line number Diff line number Diff line change
Expand Up @@ -99,12 +99,12 @@ def _x_intercept(x, k, n):
xx = np.polynomial.polynomial.polyfit(x[-n:], k[-n:], 1)
err = 0
if n > 2:
# Compute error on the ratio -xx[0] / xx[1]
# Compute error of the ratio r = -xx[0] / xx[1]
X = np.polynomial.polynomial.polyvander(x[-n:], 1)
R = k[-n:] - X @ xx
S2 = np.sum(R**2) / float(n - 2)
COV = S2 * np.linalg.inv(X.T @ X)
J = [1 / xx[1], -xx[0] / xx[1] ** 2]
J = [-1 / xx[1], xx[0] / xx[1] ** 2] # Jacobian [dr/d(xx[0]) , dr/d(xx[1])]
err = np.sqrt(J @ COV @ J)

# return x @y=0
Expand Down Expand Up @@ -346,7 +346,7 @@ def measure(
# Initial values
self._initial_k0 = [self._h_steer.strength.get(), self._v_steer.strength.get()]
self._initial_k1 = self._quad.strength.get()
self._quad_polarity = np.sign(self._initial_k1)
self._quad_polarity = np.sign(self._initial_k1) if self._initial_k1 != 0 else 1

self._ref_ios, fx, fy = self._init_responses(
self._cfg.tune_correction_name,
Expand Down
Loading