def __init__(self, settings): Trajectory.__init__(self, settings) # calculate symbolic derivatives up to order n t, a, f, off, p = sp.symbols("t, a, f, off, p") self.yd_sym = [] harmonic = a * sp.sin(2 * sp.pi * f * t + p) + off for idx in range(settings["differential_order"] + 1): self.yd_sym.append(harmonic.diff(t, idx)) # lambdify for idx, val in enumerate(self.yd_sym): self.yd_sym[idx] = sp.lambdify((t, a, f, off, p), val, "numpy")
def __init__(self, settings): Trajectory.__init__(self, settings) # setup symbolic expressions tau, k = sp.symbols('tau, k') gamma = self._settings["differential_order"] + 1 alpha = sp.factorial(2 * gamma + 1) f = sp.binomial(gamma, k) * (-1) ** k * tau ** (gamma + k + 1) / (gamma + k + 1) phi = alpha / sp.factorial(gamma) ** 2 * sp.summation(f, (k, 0, gamma)) # differentiate phi(tau), index in list corresponds to order dphi_sym = [phi] # init with phi(tau) for order in range(self._settings["differential_order"]): dphi_sym.append(dphi_sym[-1].diff(tau)) # lambdify self.dphi_num = [] for der in dphi_sym: self.dphi_num.append(sp.lambdify(tau, der, 'numpy'))
def __init__(self, settings): Trajectory.__init__(self, settings) # setup symbolic expressions tau, k = sp.symbols('tau, k') gamma = self._settings["differential_order"] + 1 alpha = sp.factorial(2 * gamma + 1) f = sp.binomial(gamma, k) * (-1)**k * tau**(gamma + k + 1) / (gamma + k + 1) phi = alpha / sp.factorial(gamma)**2 * sp.summation(f, (k, 0, gamma)) # differentiate phi(tau), index in list corresponds to order dphi_sym = [phi] # init with phi(tau) for order in range(self._settings["differential_order"]): dphi_sym.append(dphi_sym[-1].diff(tau)) # lambdify self.dphi_num = [] for der in dphi_sym: self.dphi_num.append(sp.lambdify(tau, der, 'numpy'))
def __init__(self, settings): Trajectory.__init__(self, settings) if len(self._settings["State"]) != len(self._settings["Setpoint"]): raise TrajectoryException( "The amount of states and setpoints is not equal")
def __init__(self, settings): Trajectory.__init__(self, settings) if len(self._settings["State"]) != len(self._settings["Setpoint"]): raise TrajectoryException("The amount of states and setpoints is not equal")