同步操作将从 Gitee 极速下载/PythonRobotics 强制同步,此操作会覆盖自 Fork 仓库以来所做的任何修改,且无法恢复!!!
确定后同步将在后台操作,完成时将刷新页面,请耐心等待。
import conftestimport numpy as npimport pytestfrom PathPlanning.BSplinePath import bspline_pathdef test_list_input():way_point_x = [-1.0, 3.0, 4.0, 2.0, 1.0]way_point_y = [0.0, -3.0, 1.0, 1.0, 3.0]n_course_point = 50 # sampling numberrax, ray, heading, curvature = bspline_path.approximate_b_spline_path(way_point_x, way_point_y, n_course_point, s=0.5)assert len(rax) == len(ray) == len(heading) == len(curvature)rix, riy, heading, curvature = bspline_path.interpolate_b_spline_path(way_point_x, way_point_y, n_course_point)assert len(rix) == len(riy) == len(heading) == len(curvature)def test_array_input():way_point_x = np.array([-1.0, 3.0, 4.0, 2.0, 1.0])way_point_y = np.array([0.0, -3.0, 1.0, 1.0, 3.0])n_course_point = 50 # sampling numberrax, ray, heading, curvature = bspline_path.approximate_b_spline_path(way_point_x, way_point_y, n_course_point, s=0.5)assert len(rax) == len(ray) == len(heading) == len(curvature)rix, riy, heading, curvature = bspline_path.interpolate_b_spline_path(way_point_x, way_point_y, n_course_point)assert len(rix) == len(riy) == len(heading) == len(curvature)def test_degree_change():way_point_x = np.array([-1.0, 3.0, 4.0, 2.0, 1.0])way_point_y = np.array([0.0, -3.0, 1.0, 1.0, 3.0])n_course_point = 50 # sampling numberrax, ray, heading, curvature = bspline_path.approximate_b_spline_path(way_point_x, way_point_y, n_course_point, s=0.5, degree=4)assert len(rax) == len(ray) == len(heading) == len(curvature)rix, riy, heading, curvature = bspline_path.interpolate_b_spline_path(way_point_x, way_point_y, n_course_point, degree=4)assert len(rix) == len(riy) == len(heading) == len(curvature)rax, ray, heading, curvature = bspline_path.approximate_b_spline_path(way_point_x, way_point_y, n_course_point, s=0.5, degree=2)assert len(rax) == len(ray) == len(heading) == len(curvature)rix, riy, heading, curvature = bspline_path.interpolate_b_spline_path(way_point_x, way_point_y, n_course_point, degree=2)assert len(rix) == len(riy) == len(heading) == len(curvature)with pytest.raises(ValueError):bspline_path.approximate_b_spline_path(way_point_x, way_point_y, n_course_point, s=0.5, degree=1)with pytest.raises(ValueError):bspline_path.interpolate_b_spline_path(way_point_x, way_point_y, n_course_point, degree=1)if __name__ == '__main__':conftest.run_this_test(__file__)
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。