test_BSpline¶
- test_BSpline.test_BSpline(show_plots, P, XDot_flag, XDDot_flag, accuracy)[source]¶
- Validation Test Description - This unit test script tests the capability of the BSpline function to correctly interpolate a series of points in 3 dimensions. The coordinates of these 7 points are stored in 3 numpy arrays: - X1 = np.array([0, 1, 2, 3, 4, 5, 6]) - X2 = np.array([5, 4, 3, 2, 1, 0, 1]) - X3 = np.array([3, 2, 1, 2, 3, 4, 5]). - The input arrays are initialized through - Input = BSpline.InputDataSet(X1, X2, X3). The time tags at which each waypoint is to be hit are provided through- Input.setT([0, 2, 3, 5, 7, 8, 10]). Alternatively, it is possible to specify the average velocity norm through- Input.setAvgXDot(). The endpoint derivatives are specified through the methods:- Input.setXDot_0()for starting point first-order derivative;
- Input.setXDot_N()for last point first-order derivative;
- Input.setXDDot_0()for starting point second-order derivative;
- Input.setXDDot_N()for last point second-order derivative.
 - Each method to specify the derivatives takes in a 3-dimensional numpy array. The output data structure is created with - Output = BSpline.OutputDataSet(). The interpolation happens calling the method- BSpline.interpolate(Input, N, P, Output)where:- N is the desired number of equally spaced data points in the interpolated function; 
- P is the polynomial order of the B-Spline function. The order should be at least 3 when first-order derivatives are specified, and 5 when second-order derivatives are specified. The maximum oder is P = n + k - 1, with n being the number of waypoints and k being the number of endpoint derivatives that are being specified. 
 - Test Parameters - As this is a parameterized unit test, note that the test case parameters values are shown automatically in the pytest HTML report. This sample script has the parameters param1 and param 2. Provide a description of what each parameter controls. This is a convenient location to include the accuracy variable used in the validation test. - Parameters
- P (int) – polynomial order of the B-Spline curve; 
- XDot_flag (bool) – whether the first-order end point derivatives should be specified; 
- XDDot_flag (bool) – whether the second-order end point derivatives should be specified; 
- accuracy (float) – absolute accuracy value used in the validation tests. 
 
 - Description of Variables Being Tested - This unit test checks the correctness of the interpolated function: - a check is performed on whether or not each waypoint is hit at the specified time; - when the derivatives are specified, it checks whether the starting point derivative actually matches the input derivative.