def give_a_2dof_function_without_derivatives(): f = toppra.SimplePath([0, 1, 2], np.array([[0, 0], [1, 2.0], [1, 2.0]])) yield f
def given_a_vector_path_without_specified_derivative(): yield toppra.SimplePath([0, 1, 2], np.array([[0, 0], [1, 2], [1, 2]]))
def give_a_simple_scalar_function_without_derivatives(): f = toppra.SimplePath([0, 1, 2], np.array([0, 1, 1])) yield f
def given_a_simple_scalar_function_with_first_derivatives(): f = toppra.SimplePath([0, 1, 2], np.array([0, 1, 1]), np.array([0, 2, 0])) yield f
%load_ext autoreload %autoreload 2 import toppra import numpy as np import matplotlib.pyplot as plt import scipy.interpolate as si p = toppra.SimplePath(np.r_[0, 1, 2], np.r_[0, 1, 0]) xs = np.linspace(*p.path_interval, 200) plt.plot(xs, p(xs)) plt.show() f = si.BPoly.from_derivatives([0,0.75,2],[[0, 0], [1, 0], [0, 0]], orders=2) # f = si.CubicHermiteSpline([0,1,2],[0, 1, 0], [0, 0, 0]) x = np.linspace(0, 2, 200) plt.plot(x, f(x, 1)) plt.show()