dubins_test.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 import math
10 import numpy as np
11 from .PP_checker import IsPathCorrect
12 
13 def near(a, b, error = 1e-7):
14  assert abs(a - b) < error
15 
17  robot = f2c.Robot(2.1, 2.5);
18  robot.setCruiseVel(2.0);
19  robot.setMaxCurv(1.0);
20  robot.setMaxDiffCurv(2.0);
21 
22  turn = f2c.PP_DubinsCurves();
23  start = f2c.Point(0.0, 0.0);
24  end = f2c.Point(-3.0, 0.0);
25  path = turn.createTurn(robot, start, 0.5 * math.pi, end, 1.5 * math.pi);
26  IsPathCorrect(path, start, 0.5 * math.pi, end, 1.5 * math.pi);
27 
29  robot = f2c.Robot(2.1, 2.5);
30  robot.setCruiseVel(2.0);
31  robot.setMaxCurv(1.0);
32  robot.setMaxDiffCurv(2.0);
33  turn = f2c.PP_DubinsCurves();
34  turn.using_cache = False;
35  step = 0.01;
36  for ang in np.arange(step, math.pi, step):
37  start = f2c.Point(0.0, 0.0);
38  end = f2c.Point(4.0, 0.0);
39  path = turn.createTurn(robot, start, ang, end, ang + math.pi);
40  IsPathCorrect(path, start, ang, end, ang + math.pi);
41 
42 
44  robot = f2c.Robot(2.1, 2.5);
45  robot.setCruiseVel(2.0);
46  robot.setMaxCurv(0.3);
47  robot.setMaxDiffCurv(1.0);
48  turn = f2c.PP_DubinsCurves();
49  turn.using_cache = True;
50  path1 = turn.createTurn(robot,
51  f2c.Point(-331.021, 418.463), 4.71239,
52  f2c.Point(-328.021, 404.284), 1.5708);
53  #path4 = turn.createTurnIfNotCached(14.4929, 0.208505, 3.35);
54  path2 = turn.createTurn(robot,
55  f2c.Point(-331.021, 418.463), 4.71239,
56  f2c.Point(-328.021, 404.284), 1.5708);
57  #path3 = turn.createSimpleTurn(14.4929, 0.208505, 3.35);
58  assert path1.size() == path2.size();
59  for i in range(path1.size()):
60  assert (path1[i].point == path2[i].point);
61 
path_planning.dubins_test.test_fields2cover_pp_dubins_randomPoints
def test_fields2cover_pp_dubins_randomPoints()
Definition: dubins_test.py:28
path_planning.dubins_test.near
def near(a, b, error=1e-7)
Definition: dubins_test.py:13
path_planning.dubins_test.test_fields2cover_pp_dubins_cachedTurn
def test_fields2cover_pp_dubins_cachedTurn()
Definition: dubins_test.py:43
IsPathCorrect
testing::AssertionResult IsPathCorrect(const F2CPath &path, F2CPoint start, double start_ang, F2CPoint end, double end_ang, bool check_y_lower_limit=true)
Definition: path_planning_checker.hpp:57
path_planning.dubins_test.test_fields2cover_pp_dubins_turnDist
def test_fields2cover_pp_dubins_turnDist()
Definition: dubins_test.py:16


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