8 import fields2cover
as f2c
11 def IsPathCorrect(path, start, start_ang, end, end_ang, check_y_lower_limit = True):
12 assert not (path.size() < 3), \
13 "Error 3001: The path has only " + str(path.size()) + \
14 "points. Expected at least 3 points.";
16 assert not (check_y_lower_limit
and
17 any([s.point
for s
in path.getStates()
if s.point.getY() < -0.05])), \
18 "Error 3002: Lower limit on Y axis is crossed.";
19 assert not ((abs(path.getState(0).point.getX() - start.getX()) > 1e-1)
or
20 (abs(path.getState(0).point.getX() - start.getX()) > 1e-1)), \
21 "Error 3003: Start point should be " + str(start) +
", but is " + \
23 assert not ((abs(path.getState(0).point.getX() - start.getX()) > 1e-1)
or
24 (abs(path.getState(0).point.getX() - start.getX()) > 1e-1)), \
25 "Error 3004: End point should be " + str(end) +
", but is " + \
26 str(path.back().point) +
".";
27 assert not (f2c.Point.getAngleDiffAbs(path.getState(0).angle, start_ang) > 0.1), \
28 "Error 3006: Start angle should be " + str(start_ang) + \
29 ", but computed angle is " + str(path.getState(0).angle) +
".";
30 assert not (f2c.Point.getAngleDiffAbs(path.back().angle, end_ang) > 0.1), \
31 "Error 3007: End angle should be " + str(end_ang) + \
32 ", but computed angle is " + str(path.back().angle) +
".";
33 assert not (start.distance(end) > path.length()), \
34 "Error 3008: Length of the curve (" + str(path.length()) + \
35 ") is smaller than the distance between start to end points (" + \
36 str(start.distance(end)) +
").";