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

Function IsPathCorrect

tests/python/path_planning/PP_checker.py:11–37  ·  view source on GitHub ↗
(path, start, start_ang, end, end_ang, check_y_lower_limit = True)

Source from the content-addressed store, hash-verified

9
10
11def 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.";
15
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 " + \
22 path[0].point + ".";
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)) + ").";
37 return True
38

Calls 7

backMethod · 0.80
getAngleDiffAbsMethod · 0.80
distanceMethod · 0.80
sizeMethod · 0.45
getYMethod · 0.45
getXMethod · 0.45
lengthMethod · 0.45