MCPcopy Create free account
hub / github.com/Fields2Cover/Fields2Cover / TEST

Function TEST

tests/cpp/utils/visualizer_test.cpp:42–105  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

40}
41
42TEST(fields2cover_utils_visualizer, save_Route_and_Path) {
43 F2CCells cells {
44 F2CCell(F2CLinearRing({
45 F2CPoint(0,0), F2CPoint(2,0),F2CPoint(2,2),F2CPoint(0,2), F2CPoint(0,0)
46 }))
47 };
48 cells.addRing(0, F2CLinearRing({
49 F2CPoint(.4,.4), F2CPoint(.4,.6),F2CPoint(.6,.6),F2CPoint(.6,.4), F2CPoint(.4,.4)
50 }));
51 cells.addRing(0, F2CLinearRing({
52 F2CPoint(1.2,1.2), F2CPoint(1.2,1.6),F2CPoint(1.6,1.6),F2CPoint(1.6,1.2), F2CPoint(1.2,1.2)
53 }));
54 cells *= 3e1;
55
56 f2c::hg::ConstHL const_hl;
57 F2CCells no_hl = const_hl.generateHeadlandArea(cells, 3, 3);
58 auto hl_swaths = const_hl.generateHeadlandSwaths(cells, 3, 3, false);
59
60 f2c::sg::BruteForce bf;
61 F2CSwathsByCells swaths = bf.generateSwaths(M_PI/2.0, 3, no_hl);
62
63 f2c::rp::RoutePlannerBase route_planner;
64 F2CRoute route = route_planner.genRoute(hl_swaths[1], swaths);
65
66 f2c::Visualizer::figure();
67 f2c::Visualizer::plot(cells);
68 f2c::Visualizer::plot(no_hl);
69 f2c::Visualizer::plot(hl_swaths[1]);
70 f2c::Visualizer::plot(route.asLineString());
71 for (auto&& vs : route.getVectorSwaths()) {
72 f2c::Visualizer::plot(vs);
73 }
74 for (auto&& c : route.getConnections()) {
75 f2c::Visualizer::plot(c);
76 }
77 f2c::Visualizer::axis_equal();
78 f2c::Visualizer::save("test_fig/route_by_pieces.png");
79 EXPECT_TRUE(checkIfFileExists("test_fig/route_by_pieces.png"));
80
81
82 f2c::Visualizer::figure();
83 f2c::Visualizer::plot(cells);
84 f2c::Visualizer::plot(no_hl);
85 f2c::Visualizer::plot(hl_swaths[1]);
86 f2c::Visualizer::plot(route);
87 f2c::Visualizer::axis_equal();
88 f2c::Visualizer::save("test_fig/route.png");
89 EXPECT_TRUE(checkIfFileExists("test_fig/route.png"));
90
91 F2CRobot robot;
92 f2c::pp::PathPlanning path_planner;
93 f2c::pp::DubinsCurves dubins;
94 F2CPath path = path_planner.planPath(robot, route, dubins);
95
96 f2c::Visualizer::figure();
97 f2c::Visualizer::plot(F2CPath());
98 f2c::Visualizer::plot(cells);
99 f2c::Visualizer::plot(no_hl);

Callers

nothing calls this directly

Calls 15

checkIfFileExistsFunction · 0.85
generateHeadlandAreaMethod · 0.80
generateSwathsMethod · 0.80
genRouteMethod · 0.80
asLineStringMethod · 0.80
planPathMethod · 0.80
generateRandFieldMethod · 0.80
generateHeadlandsMethod · 0.80
getCovWidthMethod · 0.80
appendSwathMethod · 0.80
create_polygonFunction · 0.70

Tested by

no test coverage detected