8 import fields2cover
as f2c
11 def near(a, b, error = 1e-7):
12 assert abs(a - b) < error
16 swath1 = f2c.Swath(f2c.LineString(f2c.VectorPoint(
17 [f2c.Point(0.0, 0.0), f2c.Point(0.0, 1.0)])));
18 swath2 = f2c.Swath(f2c.LineString(f2c.VectorPoint(
19 [f2c.Point(1.0, 1.0), f2c.Point(1.0, 0.0)])));
20 swaths1 = f2c.Swaths();
21 [swaths1.push_back(i)
for i
in [swath1]]
22 swaths2 = f2c.Swaths();
23 [swaths2.push_back(i)
for i
in [swath2]]
25 robot = f2c.Robot(2.1, 2.5);
26 robot.setMaxCurv(2.0);
28 length = f2c.OBJ_CompleteTurnPathObj_Dubins(robot);
31 near(length.computeCost(swath1, swath2), math.pi/2, 0.1);
34 robot = f2c.Robot(2.1, 2.5);
35 objective = f2c.OBJ_CompleteTurnPathObj_Dubins(robot);
36 assert not (objective.isMaximizing());
37 assert (objective.isMinimizing());