Formula Student Autonomous Systems
The code for the main driverless system
Loading...
Searching...
No Matches
splines_tests.cpp
Go to the documentation of this file.
2
7TEST(Splines, spline1) {
8 std::vector<PathPoint> cones;
9 for (int i = 0; i < 10; i++) {
10 PathPoint c;
11 c.position.x = i;
12 c.position.y = i;
13 cones.push_back(c);
14 }
15 std::vector<PathPoint> vector2 = ::fit_spline(cones, 1, 3, 3.0);
16 for (int i = 0; i < 9; i++) {
17 EXPECT_LE(fabs(vector2[i].position.x - i), 0.1);
18 EXPECT_LE(fabs(vector2[i].position.y - i), 0.1);
19 }
20}
21
26TEST(Splines, spline2) {
27 std::vector<Cone> cones;
28 for (int i = 0; i < 10; i++) {
29 Cone c;
30 c.position.x = i;
31 c.position.y = i;
32 cones.push_back(c);
33 }
34 std::vector<Cone> vector2 = ::fit_spline(cones, 1, 3, 3.0);
35 for (int i = 0; i < 9; i++) {
36 EXPECT_LE(fabs(vector2[i].position.x - i), 0.1);
37 EXPECT_LE(fabs(vector2[i].position.y - i), 0.1);
38 }
39}
std::vector< T > fit_spline(const std::vector< T > &path, int precision, int order, float coeffs_ratio)
This function takes a sequence of points (T), fits a spline to them using B-spline basis functions,...
Definition splines.hpp:130
TEST(Splines, spline1)
Test the spline template function for a path point vector.