PP_checker.py
Go to the documentation of this file.
1 #==============================================================================
2 # Copyright (C) 2021-2024 Wageningen University - All Rights Reserved
3 # Author: Gonzalo Mier
4 # BSD-3 License
5 #==============================================================================
6 
7 import pytest
8 import fields2cover as f2c
9 
10 
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.";
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 
path_planning.PP_checker.IsPathCorrect
def IsPathCorrect(path, start, start_ang, end, end_ang, check_y_lower_limit=True)
Definition: PP_checker.py:11


fields2cover
Author(s):
autogenerated on Fri Apr 25 2025 02:18:31