7 #include <gtest/gtest.h>
12 #include "../test_helpers/path_planning_checker.hpp"
14 TEST(fields2cover_pp_dubins, turn_dist) {
16 robot.setCruiseVel(2.0);
17 robot.setMaxCurv(1.0);
18 robot.setMaxDiffCurv(1.0);
23 start, boost::math::constants::half_pi<double>(),
24 end, 3.0 * boost::math::constants::half_pi<double>());
26 end, 3.0 * boost::math::constants::half_pi<double>()));
29 TEST(fields2cover_pp_dubins, random_points) {
31 robot.setCruiseVel(2.0);
32 robot.setMaxCurv(1.0);
33 robot.setMaxDiffCurv(1.0);
38 const double step = 0.1;
39 for (
double ang = step; ang < boost::math::constants::pi<double>(); ang += step) {
42 end, ang + boost::math::constants::pi<double>());
44 end, ang + boost::math::constants::pi<double>()));
49 TEST(fields2cover_pp_dubins, cached_turn) {
51 robot.setCruiseVel(2.0);
52 robot.setMaxCurv(0.3);
53 robot.setMaxDiffCurv(1.0);
59 F2CPoint(-331.021, 418.463), 4.71239,
60 F2CPoint(-328.021, 404.284), 1.5708);
63 F2CPoint(-331.021, 418.463), 4.71239,
64 F2CPoint(-328.021, 404.284), 1.5708);
65 EXPECT_EQ(path1.size(), path2.size());
66 for (
int i = 0; i < path1.size(); ++i) {
67 EXPECT_TRUE(path1[i].point == path2[i].point);
71 TEST(fields2cover_pp_dubins, turn_valid) {
73 robot.setCruiseVel(2.0);
74 robot.setMaxCurv(0.3);
78 EXPECT_TRUE(turn.
isTurnValid(path3, 14.4929, 3.35, 0.1, 0.1));
80 path3[50].point.setY(-3);
81 EXPECT_FALSE(turn.
isTurnValid(path3, 14.4929, 3.35, 0.1, 0.1));
82 path3.back().angle = 0;
83 EXPECT_FALSE(turn.
isTurnValid(path3, 14.4929, 3.35, 0.1, 0.1));
84 path3.back().point.setY(3);
85 EXPECT_FALSE(turn.
isTurnValid(path3, 14.4929, 3.35, 0.1, 0.1));
86 path3.back().point.setX(15);
87 EXPECT_FALSE(turn.
isTurnValid(path3, 14.4929, 3.35, 0.1, 0.1));