dubins_curves_cc.cpp
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 #include <steering_functions/hc_cc_state_space/cc00_dubins_state_space.hpp>
8 #include <steering_functions/hc_cc_state_space/cc_dubins_state_space.hpp>
11 
12 namespace f2c::pp {
13 
15  double dist_start_pos, double start_angle, double end_angle) {
16  steer::State start, end;
17 
18  start.x = 0.0;
19  start.y = 0.0;
20  start.theta = start_angle;
21  start.kappa = 0.0;
22  start.d = 0;
23 
24  end.x = dist_start_pos;
25  end.y = 0.0;
26  end.theta = end_angle;
27  end.kappa = 0.0;
28  end.d = 0;
29 
30  double n = 0.0;
31  while (true) {
32  CC00_Dubins_State_Space ss(
33  robot.getMaxCurv() / (1+0.05*n),
34  robot.getMaxDiffCurv() / (1+0.2*n),
36  true);
37  if (loop_detected(ss.get_controls(start, end)) && n <= 20.) {
38  n += 1.0;
39  } else {
40  return steerStatesToPath(ss.get_path(start, end),
41  robot.getTurnVel());
42  }
43  }
44 }
45 
47  const F2CPoint& start_pos, double start_angle, double start_curvature,
48  const F2CPoint& end_pos, double end_angle, double end_curvature,
49  const bool fix_loops) {
50  steer::State start, end;
51  start.x = start_pos.getX();
52  start.y = start_pos.getY();
53  start.theta = start_angle;
54  start.kappa = start_curvature;
55  start.d = 0;
56 
57  end.x = end_pos.getX();
58  end.y = end_pos.getY();
59  end.theta = end_angle;
60  end.kappa = end_curvature;
61  end.d = 0;
62  double n = 0.0;
63 
64  while (true) {
65  CC_Dubins_State_Space ss(
66  robot.getMaxCurv() / (1 + 0.05 * n),
67  robot.getMaxDiffCurv() / (1 + 0.2 * n),
69  true);
70  if (fix_loops && loop_detected(ss.get_controls(start, end)) && n <= 20.) {
71  n += 1.0;
72  } else {
73  return steerStatesToPath(ss.get_path(start, end),
74  robot.getTurnVel());
75  }
76  }
77 }
78 
79 } // namespace f2c::pp
f2c::pp::steerStatesToPath
types::Path steerStatesToPath(const std::vector< steer::State > &curve, double const_vel)
Definition: steer_to_path.hpp:21
dubins_curves_cc.h
f2c::pp
Path planning algorithms' namespace.
Definition: dubins_curves.h:14
f2c::pp::DubinsCurvesCC::createSimpleTurn
F2CPath createSimpleTurn(const F2CRobot &robot, double dist_start_pos, double start_angle, double end_angle) override
Create a turn.
Definition: dubins_curves_cc.cpp:14
1_basic_types.end
end
Definition: 1_basic_types.py:76
steer_to_path.hpp
2_objective_functions.robot
robot
Definition: 2_objective_functions.py:76
f2c::types::Path
Definition: Path.h:23
f2c::pp::TurningBase::discretization
double discretization
Definition: turning_base.h:92
f2c::pp::DubinsCurvesCC::createConstrainedTurn
F2CPath createConstrainedTurn(const F2CRobot &robot, const F2CPoint &start_pos, double start_angle, double start_curvature, const F2CPoint &end_pos, double end_angle, double end_curvature, const bool fix_loops=false)
Definition: dubins_curves_cc.cpp:46
f2c::types::Point
Definition: Point.h:21
f2c::types::Robot
Definition: Robot.h:25
f2c::pp::loop_detected
bool loop_detected(const std::vector< steer::Control > &controls)
Definition: steer_to_path.hpp:43
f2c::types::Point::getY
double getY() const
Definition: Point.cpp:96
f2c::types::Point::getX
double getX() const
Definition: Point.cpp:95


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