steering_functions_test.cpp
Go to the documentation of this file.
1 /*********************************************************************
2 * Copyright (c) 2017 Robert Bosch GmbH.
3 * All rights reserved.
4 *
5 * Licensed under the Apache License, Version 2.0 (the "License");
6 * you may not use this file except in compliance with the License.
7 * You may obtain a copy of the License at
8 *
9 * http://www.apache.org/licenses/LICENSE-2.0
10 *
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
16 * *********************************************************************/
17 
18 #include <gtest/gtest.h>
19 #include <time.h>
20 #include <fstream>
21 #include <iostream>
22 
38 
39 #define EPS_DISTANCE 0.01 // [m]
40 #define EPS_YAW 0.01 // [rad]
41 #define EPS_KAPPA 1e-6 // [1/m]
42 #define KAPPA 1.0 // [1/m]
43 #define SIGMA 1.0 // [1/m^2]
44 #define DISCRETIZATION 0.1 // [m]
45 #define SAMPLES 1e5 // [-]
46 #define OPERATING_REGION_X 20.0 // [m]
47 #define OPERATING_REGION_Y 20.0 // [m]
48 #define OPERATING_REGION_THETA 2 * M_PI // [rad]
49 #define random(lower, upper) (rand() * (upper - lower) / RAND_MAX + lower)
50 #define random_boolean() rand() % 2
51 
52 using namespace std;
53 using namespace steering;
54 
56 {
57  State state;
58  state.x = random(-OPERATING_REGION_X / 2.0, OPERATING_REGION_X / 2.0);
59  state.y = random(-OPERATING_REGION_Y / 2.0, OPERATING_REGION_Y / 2.0);
61  state.kappa = random_boolean() * random(-KAPPA, KAPPA);
62  state.d = 0.0;
63  return state;
64 }
65 
66 double get_distance(const State& state1, const State& state2)
67 {
68  return sqrt(pow(state2.x - state1.x, 2) + pow(state2.y - state1.y, 2));
69 }
70 
71 double get_path_length(const vector<State>& path)
72 {
73  double path_length = 0;
74  State state1 = path.front();
75  for (const auto& state2 : path)
76  {
77  path_length += get_distance(state1, state2);
78  state1 = state2;
79  }
80  return path_length;
81 }
82 
83 double get_path_length(const vector<Control>& controls)
84 {
85  double path_length = 0;
86  for (const auto& control : controls)
87  path_length += fabs(control.delta_s);
88  return path_length;
89 }
90 
91 bool is_equal(const State& state1, const State& state2)
92 {
93  if (state1.x == state2.x && state1.y == state2.y && state1.theta == state2.theta && state1.kappa == state2.kappa &&
94  state1.d == state2.d)
95  {
96  return true;
97  }
98  return false;
99 }
100 
120 int seed(time(nullptr));
121 
122 TEST(SteeringFunctions, pathLength)
123 {
124  srand(seed);
125  for (int i = 0; i < SAMPLES; i++)
126  {
128  State goal;
129  if (i == 0)
130  goal = start;
131  else if (i == 1)
132  {
133  goal.x = start.x + EPS_DISTANCE;
134  goal.y = start.y + EPS_DISTANCE;
135  goal.theta = start.theta + EPS_YAW;
136  goal.kappa = start.kappa;
137  goal.d = start.d;
138  }
139  else
140  goal = get_random_state();
141 
142  vector<State> cc_dubins_path_forwards = cc_dubins_forwards_ss.get_path(start, goal);
143  EXPECT_LT(fabs(cc_dubins_forwards_ss.get_distance(start, goal) - get_path_length(cc_dubins_path_forwards)),
144  EPS_DISTANCE);
145 
146  vector<State> cc_dubins_path_backwards = cc_dubins_backwards_ss.get_path(start, goal);
147  EXPECT_LT(fabs(cc_dubins_backwards_ss.get_distance(start, goal) - get_path_length(cc_dubins_path_backwards)),
148  EPS_DISTANCE);
149 
150  vector<State> cc00_dubins_path_forwards = cc00_dubins_forwards_ss.get_path(start, goal);
151  EXPECT_LT(fabs(cc00_dubins_forwards_ss.get_distance(start, goal) - get_path_length(cc00_dubins_path_forwards)),
152  EPS_DISTANCE);
153 
154  vector<State> cc00_dubins_path_backwards = cc00_dubins_backwards_ss.get_path(start, goal);
155  EXPECT_LT(fabs(cc00_dubins_backwards_ss.get_distance(start, goal) - get_path_length(cc00_dubins_path_backwards)),
156  EPS_DISTANCE);
157 
158  vector<State> cc0pm_dubins_path_forwards = cc0pm_dubins_forwards_ss.get_path(start, goal);
159  EXPECT_LT(fabs(cc0pm_dubins_forwards_ss.get_distance(start, goal) - get_path_length(cc0pm_dubins_path_forwards)),
160  EPS_DISTANCE);
161 
162  vector<State> cc0pm_dubins_path_backwards = cc0pm_dubins_backwards_ss.get_path(start, goal);
163  EXPECT_LT(fabs(cc0pm_dubins_backwards_ss.get_distance(start, goal) - get_path_length(cc0pm_dubins_path_backwards)),
164  EPS_DISTANCE);
165 
166  vector<State> ccpm0_dubins_path_forwards = ccpm0_dubins_forwards_ss.get_path(start, goal);
167  EXPECT_LT(fabs(ccpm0_dubins_forwards_ss.get_distance(start, goal) - get_path_length(ccpm0_dubins_path_forwards)),
168  EPS_DISTANCE);
169 
170  vector<State> ccpm0_dubins_path_backwards = ccpm0_dubins_backwards_ss.get_path(start, goal);
171  EXPECT_LT(fabs(ccpm0_dubins_backwards_ss.get_distance(start, goal) - get_path_length(ccpm0_dubins_path_backwards)),
172  EPS_DISTANCE);
173 
174  vector<State> ccpmpm_dubins_path_forwards = ccpmpm_dubins_forwards_ss.get_path(start, goal);
175  EXPECT_LT(fabs(ccpmpm_dubins_forwards_ss.get_distance(start, goal) - get_path_length(ccpmpm_dubins_path_forwards)),
176  EPS_DISTANCE);
177 
178  vector<State> ccpmpm_dubins_path_backwards = ccpmpm_dubins_backwards_ss.get_path(start, goal);
179  EXPECT_LT(
180  fabs(ccpmpm_dubins_backwards_ss.get_distance(start, goal) - get_path_length(ccpmpm_dubins_path_backwards)),
181  EPS_DISTANCE);
182 
183  vector<State> dubins_path_forwards = dubins_forwards_ss.get_path(start, goal);
184  EXPECT_LT(fabs(dubins_forwards_ss.get_distance(start, goal) - get_path_length(dubins_path_forwards)), EPS_DISTANCE);
185 
186  vector<State> dubins_path_backwards = dubins_backwards_ss.get_path(start, goal);
187  EXPECT_LT(fabs(dubins_backwards_ss.get_distance(start, goal) - get_path_length(dubins_path_backwards)),
188  EPS_DISTANCE);
189 
190  vector<State> cc00_rs_path = cc00_rs_ss.get_path(start, goal);
191  EXPECT_LT(fabs(cc00_rs_ss.get_distance(start, goal) - get_path_length(cc00_rs_path)), EPS_DISTANCE);
192 
193  vector<State> hc_rs_path = hc_rs_ss.get_path(start, goal);
194  EXPECT_LT(fabs(hc_rs_ss.get_distance(start, goal) - get_path_length(hc_rs_path)), EPS_DISTANCE);
195 
196  vector<State> hc00_rs_path = hc00_rs_ss.get_path(start, goal);
197  EXPECT_LT(fabs(hc00_rs_ss.get_distance(start, goal) - get_path_length(hc00_rs_path)), EPS_DISTANCE);
198 
199  vector<State> hc0pm_rs_path = hc0pm_rs_ss.get_path(start, goal);
200  EXPECT_LT(fabs(hc0pm_rs_ss.get_distance(start, goal) - get_path_length(hc0pm_rs_path)), EPS_DISTANCE);
201 
202  vector<State> hcpm0_rs_path = hcpm0_rs_ss.get_path(start, goal);
203  EXPECT_LT(fabs(hcpm0_rs_ss.get_distance(start, goal) - get_path_length(hcpm0_rs_path)), EPS_DISTANCE);
204 
205  vector<State> hcpmpm_rs_path = hcpmpm_rs_ss.get_path(start, goal);
206  EXPECT_LT(fabs(hcpmpm_rs_ss.get_distance(start, goal) - get_path_length(hcpmpm_rs_path)), EPS_DISTANCE);
207 
208  vector<State> rs_path = rs_ss.get_path(start, goal);
209  EXPECT_LT(fabs(rs_ss.get_distance(start, goal) - get_path_length(rs_path)), EPS_DISTANCE);
210  }
211 }
212 
213 TEST(SteeringFunctions, reachingGoal)
214 {
215  srand(seed);
216  for (int i = 0; i < SAMPLES; i++)
217  {
219  State goal;
220  if (i == 0)
221  goal = start;
222  else if (i == 1)
223  {
224  goal.x = start.x + EPS_DISTANCE;
225  goal.y = start.y + EPS_DISTANCE;
226  goal.theta = start.theta + EPS_YAW;
227  goal.kappa = start.kappa;
228  goal.d = start.d;
229  }
230  else
231  goal = get_random_state();
232 
233  vector<State> cc_dubins_path_forwards = cc_dubins_forwards_ss.get_path(start, goal);
234  EXPECT_LT(get_distance(goal, cc_dubins_path_forwards.back()), EPS_DISTANCE);
235 
236  vector<State> cc_dubins_path_backwards = cc_dubins_backwards_ss.get_path(start, goal);
237  EXPECT_LT(get_distance(goal, cc_dubins_path_backwards.back()), EPS_DISTANCE);
238 
239  vector<State> cc00_dubins_path_forwards = cc00_dubins_forwards_ss.get_path(start, goal);
240  EXPECT_LT(get_distance(goal, cc00_dubins_path_forwards.back()), EPS_DISTANCE);
241 
242  vector<State> cc00_dubins_path_backwards = cc00_dubins_backwards_ss.get_path(start, goal);
243  EXPECT_LT(get_distance(goal, cc00_dubins_path_backwards.back()), EPS_DISTANCE);
244 
245  vector<State> cc0pm_dubins_path_forwards = cc0pm_dubins_forwards_ss.get_path(start, goal);
246  EXPECT_LT(get_distance(goal, cc0pm_dubins_path_forwards.back()), EPS_DISTANCE);
247 
248  vector<State> cc0pm_dubins_path_backwards = cc0pm_dubins_backwards_ss.get_path(start, goal);
249  EXPECT_LT(get_distance(goal, cc0pm_dubins_path_backwards.back()), EPS_DISTANCE);
250 
251  vector<State> ccpm0_dubins_path_forwards = ccpm0_dubins_forwards_ss.get_path(start, goal);
252  EXPECT_LT(get_distance(goal, ccpm0_dubins_path_forwards.back()), EPS_DISTANCE);
253 
254  vector<State> ccpm0_dubins_path_backwards = ccpm0_dubins_backwards_ss.get_path(start, goal);
255  EXPECT_LT(get_distance(goal, ccpm0_dubins_path_backwards.back()), EPS_DISTANCE);
256 
257  vector<State> ccpmpm_dubins_path_forwards = ccpmpm_dubins_forwards_ss.get_path(start, goal);
258  EXPECT_LT(get_distance(goal, ccpmpm_dubins_path_forwards.back()), EPS_DISTANCE);
259 
260  vector<State> ccpmpm_dubins_path_backwards = ccpmpm_dubins_backwards_ss.get_path(start, goal);
261  EXPECT_LT(get_distance(goal, ccpmpm_dubins_path_backwards.back()), EPS_DISTANCE);
262 
263  vector<State> dubins_path_forwards = dubins_forwards_ss.get_path(start, goal);
264  EXPECT_LT(get_distance(goal, dubins_path_forwards.back()), EPS_DISTANCE);
265 
266  vector<State> dubins_path_backwards = dubins_backwards_ss.get_path(start, goal);
267  EXPECT_LT(get_distance(goal, dubins_path_backwards.back()), EPS_DISTANCE);
268 
269  vector<State> cc00_rs_path = cc00_rs_ss.get_path(start, goal);
270  EXPECT_LT(get_distance(goal, cc00_rs_path.back()), EPS_DISTANCE);
271 
272  vector<State> hc_rs_path = hc_rs_ss.get_path(start, goal);
273  EXPECT_LT(get_distance(goal, hc_rs_path.back()), EPS_DISTANCE);
274 
275  vector<State> hc00_rs_path = hc00_rs_ss.get_path(start, goal);
276  EXPECT_LT(get_distance(goal, hc00_rs_path.back()), EPS_DISTANCE);
277 
278  vector<State> hc0pm_rs_path = hc0pm_rs_ss.get_path(start, goal);
279  EXPECT_LT(get_distance(goal, hc0pm_rs_path.back()), EPS_DISTANCE);
280 
281  vector<State> hcpm0_rs_path = hcpm0_rs_ss.get_path(start, goal);
282  EXPECT_LT(get_distance(goal, hcpm0_rs_path.back()), EPS_DISTANCE);
283 
284  vector<State> hcpmpm_rs_path = hcpmpm_rs_ss.get_path(start, goal);
285  EXPECT_LT(get_distance(goal, hcpmpm_rs_path.back()), EPS_DISTANCE);
286 
287  vector<State> rs_path = rs_ss.get_path(start, goal);
288  EXPECT_LT(get_distance(goal, rs_path.back()), EPS_DISTANCE);
289  }
290 }
291 
292 TEST(SteeringFunctions, curvatureContinuity)
293 {
294  srand(seed);
295  for (int i = 0; i < SAMPLES; i++)
296  {
298  State goal;
299  if (i == 0)
300  goal = start;
301  else if (i == 1)
302  {
303  goal.x = start.x + EPS_DISTANCE;
304  goal.y = start.y + EPS_DISTANCE;
305  goal.theta = start.theta + EPS_YAW;
306  goal.kappa = start.kappa;
307  goal.d = start.d;
308  }
309  else
310  goal = get_random_state();
311 
312  State state1;
313 
314  vector<State> cc_dubins_forwards_path = cc_dubins_forwards_ss.get_path(start, goal);
315  state1 = cc_dubins_forwards_path.front();
316  for (const auto& state2 : cc_dubins_forwards_path)
317  {
318  EXPECT_LE(fabs(state1.kappa - state2.kappa), DISCRETIZATION * SIGMA + EPS_KAPPA);
319  state1 = state2;
320  }
321 
322  vector<State> cc_dubins_backwards_path = cc_dubins_backwards_ss.get_path(start, goal);
323  state1 = cc_dubins_backwards_path.front();
324  for (const auto& state2 : cc_dubins_backwards_path)
325  {
326  EXPECT_LE(fabs(state1.kappa - state2.kappa), DISCRETIZATION * SIGMA + EPS_KAPPA);
327  state1 = state2;
328  }
329 
330  vector<State> cc00_dubins_forwards_path = cc00_dubins_forwards_ss.get_path(start, goal);
331  state1 = cc00_dubins_forwards_path.front();
332  for (const auto& state2 : cc00_dubins_forwards_path)
333  {
334  EXPECT_LE(fabs(state1.kappa - state2.kappa), DISCRETIZATION * SIGMA + EPS_KAPPA);
335  state1 = state2;
336  }
337 
338  vector<State> cc00_dubins_backwards_path = cc00_dubins_backwards_ss.get_path(start, goal);
339  state1 = cc00_dubins_backwards_path.front();
340  for (const auto& state2 : cc00_dubins_backwards_path)
341  {
342  EXPECT_LE(fabs(state1.kappa - state2.kappa), DISCRETIZATION * SIGMA + EPS_KAPPA);
343  state1 = state2;
344  }
345 
346  vector<State> cc0pm_dubins_forwards_path = cc0pm_dubins_forwards_ss.get_path(start, goal);
347  state1 = cc0pm_dubins_forwards_path.front();
348  for (const auto& state2 : cc0pm_dubins_forwards_path)
349  {
350  EXPECT_LE(fabs(state1.kappa - state2.kappa), DISCRETIZATION * SIGMA + EPS_KAPPA);
351  state1 = state2;
352  }
353 
354  vector<State> cc0pm_dubins_backwards_path = cc0pm_dubins_backwards_ss.get_path(start, goal);
355  state1 = cc0pm_dubins_backwards_path.front();
356  for (const auto& state2 : cc0pm_dubins_backwards_path)
357  {
358  EXPECT_LE(fabs(state1.kappa - state2.kappa), DISCRETIZATION * SIGMA + EPS_KAPPA);
359  state1 = state2;
360  }
361 
362  vector<State> ccpm0_dubins_forwards_path = ccpm0_dubins_forwards_ss.get_path(start, goal);
363  state1 = ccpm0_dubins_forwards_path.front();
364  for (const auto& state2 : ccpm0_dubins_forwards_path)
365  {
366  EXPECT_LE(fabs(state1.kappa - state2.kappa), DISCRETIZATION * SIGMA + EPS_KAPPA);
367  state1 = state2;
368  }
369 
370  vector<State> ccpm0_dubins_backwards_path = ccpm0_dubins_backwards_ss.get_path(start, goal);
371  state1 = ccpm0_dubins_backwards_path.front();
372  for (const auto& state2 : ccpm0_dubins_backwards_path)
373  {
374  EXPECT_LE(fabs(state1.kappa - state2.kappa), DISCRETIZATION * SIGMA + EPS_KAPPA);
375  state1 = state2;
376  }
377 
378  vector<State> ccpmpm_dubins_forwards_path = ccpmpm_dubins_forwards_ss.get_path(start, goal);
379  state1 = ccpmpm_dubins_forwards_path.front();
380  for (const auto& state2 : ccpmpm_dubins_forwards_path)
381  {
382  EXPECT_LE(fabs(state1.kappa - state2.kappa), DISCRETIZATION * SIGMA + EPS_KAPPA);
383  state1 = state2;
384  }
385 
386  vector<State> ccpmpm_dubins_backwards_path = ccpmpm_dubins_backwards_ss.get_path(start, goal);
387  state1 = ccpmpm_dubins_backwards_path.front();
388  for (const auto& state2 : ccpmpm_dubins_backwards_path)
389  {
390  EXPECT_LE(fabs(state1.kappa - state2.kappa), DISCRETIZATION * SIGMA + EPS_KAPPA);
391  state1 = state2;
392  }
393 
394  vector<State> cc00_rs_path = cc00_rs_ss.get_path(start, goal);
395  state1 = cc00_rs_path.front();
396  for (const auto& state2 : cc00_rs_path)
397  {
398  EXPECT_LE(fabs(state1.kappa - state2.kappa), DISCRETIZATION * SIGMA + EPS_KAPPA);
399  state1 = state2;
400  }
401 
402  vector<State> hc_rs_path = hc_rs_ss.get_path(start, goal);
403  state1 = hc_rs_path.front();
404  for (const auto& state2 : hc_rs_path)
405  {
406  if (state1.d * state2.d >= 0)
407  {
408  EXPECT_LE(fabs(state1.kappa - state2.kappa), DISCRETIZATION * SIGMA + EPS_KAPPA);
409  }
410  state1 = state2;
411  }
412 
413  vector<State> hc00_rs_path = hc00_rs_ss.get_path(start, goal);
414  state1 = hc00_rs_path.front();
415  for (const auto& state2 : hc00_rs_path)
416  {
417  if (state1.d * state2.d >= 0)
418  {
419  EXPECT_LE(fabs(state1.kappa - state2.kappa), DISCRETIZATION * SIGMA + EPS_KAPPA);
420  }
421  state1 = state2;
422  }
423 
424  vector<State> hc0pm_rs_path = hc0pm_rs_ss.get_path(start, goal);
425  state1 = hc0pm_rs_path.front();
426  for (const auto& state2 : hc0pm_rs_path)
427  {
428  if (state1.d * state2.d >= 0)
429  {
430  EXPECT_LE(fabs(state1.kappa - state2.kappa), DISCRETIZATION * SIGMA + EPS_KAPPA);
431  }
432  state1 = state2;
433  }
434 
435  vector<State> hcpm0_rs_path = hcpm0_rs_ss.get_path(start, goal);
436  state1 = hcpm0_rs_path.front();
437  for (const auto& state2 : hcpm0_rs_path)
438  {
439  if (state1.d * state2.d >= 0)
440  {
441  EXPECT_LE(fabs(state1.kappa - state2.kappa), DISCRETIZATION * SIGMA + EPS_KAPPA);
442  }
443  state1 = state2;
444  }
445 
446  vector<State> hcpmpm_rs_path = hcpmpm_rs_ss.get_path(start, goal);
447  state1 = hcpmpm_rs_path.front();
448  for (const auto& state2 : hcpmpm_rs_path)
449  {
450  if (state1.d * state2.d >= 0)
451  {
452  EXPECT_LE(fabs(state1.kappa - state2.kappa), DISCRETIZATION * SIGMA + EPS_KAPPA);
453  }
454  state1 = state2;
455  }
456  }
457 }
458 
459 TEST(SteeringFunctions, interpolation)
460 {
461  srand(seed);
462  double s(0.0);
463  for (int i = 0; i < SAMPLES; i++)
464  {
465  double t = ((double)rand() / (RAND_MAX));
467  State goal;
468  if (i == 0)
469  goal = start;
470  else if (i == 1)
471  {
472  goal.x = start.x + EPS_DISTANCE;
473  goal.y = start.y + EPS_DISTANCE;
474  goal.theta = start.theta + EPS_YAW;
475  goal.kappa = start.kappa;
476  goal.d = start.d;
477  }
478  else
479  goal = get_random_state();
480 
481  vector<Control> cc_dubins_forwards_controls = cc_dubins_forwards_ss.get_controls(start, goal);
482  double cc_dubins_forwards_s_path = get_path_length(cc_dubins_forwards_controls);
483  double cc_dubins_forwards_s_inter = t * cc_dubins_forwards_s_path;
484  s = 0.0;
485  vector<Control> cc_dubins_forwards_controls_inter;
486  cc_dubins_forwards_controls_inter.reserve(cc_dubins_forwards_controls.size());
487  for (const auto& control : cc_dubins_forwards_controls)
488  {
489  double abs_delta_s = fabs(control.delta_s);
490  s += abs_delta_s;
491  if (s < cc_dubins_forwards_s_inter)
492  cc_dubins_forwards_controls_inter.push_back(control);
493  else
494  {
495  Control control_inter;
496  control_inter.delta_s = sgn(control.delta_s) * (abs_delta_s - (s - cc_dubins_forwards_s_inter));
497  control_inter.kappa = control.kappa;
498  control_inter.sigma = control.sigma;
499  cc_dubins_forwards_controls_inter.push_back(control_inter);
500  break;
501  }
502  }
503  vector<State> cc_dubins_forwards_path = cc_dubins_forwards_ss.integrate(start, cc_dubins_forwards_controls_inter);
504  State cc_dubins_forwards_state_inter = cc_dubins_forwards_ss.interpolate(start, cc_dubins_forwards_controls, t);
505  EXPECT_EQ(is_equal(cc_dubins_forwards_path.back(), cc_dubins_forwards_state_inter), true);
506 
507  vector<Control> cc00_dubins_forwards_controls = cc00_dubins_forwards_ss.get_controls(start, goal);
508  double cc00_dubins_forwards_s_path = get_path_length(cc00_dubins_forwards_controls);
509  double cc00_dubins_forwards_s_inter = t * cc00_dubins_forwards_s_path;
510  s = 0.0;
511  vector<Control> cc00_dubins_forwards_controls_inter;
512  cc00_dubins_forwards_controls_inter.reserve(cc00_dubins_forwards_controls.size());
513  for (const auto& control : cc00_dubins_forwards_controls)
514  {
515  double abs_delta_s = fabs(control.delta_s);
516  s += abs_delta_s;
517  if (s < cc00_dubins_forwards_s_inter)
518  cc00_dubins_forwards_controls_inter.push_back(control);
519  else
520  {
521  Control control_inter;
522  control_inter.delta_s = sgn(control.delta_s) * (abs_delta_s - (s - cc00_dubins_forwards_s_inter));
523  control_inter.kappa = control.kappa;
524  control_inter.sigma = control.sigma;
525  cc00_dubins_forwards_controls_inter.push_back(control_inter);
526  break;
527  }
528  }
529  vector<State> cc00_dubins_forwards_path =
530  cc00_dubins_forwards_ss.integrate(start, cc00_dubins_forwards_controls_inter);
531  State cc00_dubins_forwards_state_inter =
532  cc00_dubins_forwards_ss.interpolate(start, cc00_dubins_forwards_controls, t);
533  EXPECT_EQ(is_equal(cc00_dubins_forwards_path.back(), cc00_dubins_forwards_state_inter), true);
534 
535  vector<Control> cc0pm_dubins_forwards_controls = cc0pm_dubins_forwards_ss.get_controls(start, goal);
536  double cc0pm_dubins_forwards_s_path = get_path_length(cc0pm_dubins_forwards_controls);
537  double cc0pm_dubins_forwards_s_inter = t * cc0pm_dubins_forwards_s_path;
538  s = 0.0;
539  vector<Control> cc0pm_dubins_forwards_controls_inter;
540  cc0pm_dubins_forwards_controls_inter.reserve(cc0pm_dubins_forwards_controls.size());
541  for (const auto& control : cc0pm_dubins_forwards_controls)
542  {
543  double abs_delta_s = fabs(control.delta_s);
544  s += abs_delta_s;
545  if (s < cc0pm_dubins_forwards_s_inter)
546  cc0pm_dubins_forwards_controls_inter.push_back(control);
547  else
548  {
549  Control control_inter;
550  control_inter.delta_s = sgn(control.delta_s) * (abs_delta_s - (s - cc0pm_dubins_forwards_s_inter));
551  control_inter.kappa = control.kappa;
552  control_inter.sigma = control.sigma;
553  cc0pm_dubins_forwards_controls_inter.push_back(control_inter);
554  break;
555  }
556  }
557  vector<State> cc0pm_dubins_forwards_path =
558  cc0pm_dubins_forwards_ss.integrate(start, cc0pm_dubins_forwards_controls_inter);
559  State cc0pm_dubins_forwards_state_inter =
560  cc0pm_dubins_forwards_ss.interpolate(start, cc0pm_dubins_forwards_controls, t);
561  EXPECT_EQ(is_equal(cc0pm_dubins_forwards_path.back(), cc0pm_dubins_forwards_state_inter), true);
562 
563  vector<Control> ccpm0_dubins_forwards_controls = ccpm0_dubins_forwards_ss.get_controls(start, goal);
564  double ccpm0_dubins_forwards_s_path = get_path_length(ccpm0_dubins_forwards_controls);
565  double ccpm0_dubins_forwards_s_inter = t * ccpm0_dubins_forwards_s_path;
566  s = 0.0;
567  vector<Control> ccpm0_dubins_forwards_controls_inter;
568  ccpm0_dubins_forwards_controls_inter.reserve(ccpm0_dubins_forwards_controls.size());
569  for (const auto& control : ccpm0_dubins_forwards_controls)
570  {
571  double abs_delta_s = fabs(control.delta_s);
572  s += abs_delta_s;
573  if (s < ccpm0_dubins_forwards_s_inter)
574  ccpm0_dubins_forwards_controls_inter.push_back(control);
575  else
576  {
577  Control control_inter;
578  control_inter.delta_s = sgn(control.delta_s) * (abs_delta_s - (s - ccpm0_dubins_forwards_s_inter));
579  control_inter.kappa = control.kappa;
580  control_inter.sigma = control.sigma;
581  ccpm0_dubins_forwards_controls_inter.push_back(control_inter);
582  break;
583  }
584  }
585  vector<State> ccpm0_dubins_forwards_path =
586  ccpm0_dubins_forwards_ss.integrate(start, ccpm0_dubins_forwards_controls_inter);
587  State ccpm0_dubins_forwards_state_inter =
588  ccpm0_dubins_forwards_ss.interpolate(start, ccpm0_dubins_forwards_controls, t);
589  EXPECT_EQ(is_equal(ccpm0_dubins_forwards_path.back(), ccpm0_dubins_forwards_state_inter), true);
590 
591  vector<Control> ccpmpm_dubins_forwards_controls = ccpmpm_dubins_forwards_ss.get_controls(start, goal);
592  double ccpmpm_dubins_forwards_s_path = get_path_length(ccpmpm_dubins_forwards_controls);
593  double ccpmpm_dubins_forwards_s_inter = t * ccpmpm_dubins_forwards_s_path;
594  s = 0.0;
595  vector<Control> ccpmpm_dubins_forwards_controls_inter;
596  ccpmpm_dubins_forwards_controls_inter.reserve(ccpmpm_dubins_forwards_controls.size());
597  for (const auto& control : ccpmpm_dubins_forwards_controls)
598  {
599  double abs_delta_s = fabs(control.delta_s);
600  s += abs_delta_s;
601  if (s < ccpmpm_dubins_forwards_s_inter)
602  ccpmpm_dubins_forwards_controls_inter.push_back(control);
603  else
604  {
605  Control control_inter;
606  control_inter.delta_s = sgn(control.delta_s) * (abs_delta_s - (s - ccpmpm_dubins_forwards_s_inter));
607  control_inter.kappa = control.kappa;
608  control_inter.sigma = control.sigma;
609  ccpmpm_dubins_forwards_controls_inter.push_back(control_inter);
610  break;
611  }
612  }
613  vector<State> ccpmpm_dubins_forwards_path =
614  ccpmpm_dubins_forwards_ss.integrate(start, ccpmpm_dubins_forwards_controls_inter);
615  State ccpmpm_dubins_forwards_state_inter =
616  ccpmpm_dubins_forwards_ss.interpolate(start, ccpmpm_dubins_forwards_controls, t);
617  EXPECT_EQ(is_equal(ccpmpm_dubins_forwards_path.back(), ccpmpm_dubins_forwards_state_inter), true);
618 
619  vector<Control> dubins_forwards_controls = dubins_forwards_ss.get_controls(start, goal);
620  double dubins_forwards_s_path = get_path_length(dubins_forwards_controls);
621  double dubins_forwards_s_inter = t * dubins_forwards_s_path;
622  s = 0.0;
623  vector<Control> dubins_forwards_controls_inter;
624  dubins_forwards_controls_inter.reserve(dubins_forwards_controls.size());
625  for (const auto& control : dubins_forwards_controls)
626  {
627  double abs_delta_s = fabs(control.delta_s);
628  s += abs_delta_s;
629  if (s < dubins_forwards_s_inter)
630  dubins_forwards_controls_inter.push_back(control);
631  else
632  {
633  Control control_inter;
634  control_inter.delta_s = sgn(control.delta_s) * (abs_delta_s - (s - dubins_forwards_s_inter));
635  control_inter.kappa = control.kappa;
636  control_inter.sigma = control.sigma;
637  dubins_forwards_controls_inter.push_back(control_inter);
638  break;
639  }
640  }
641  vector<State> dubins_forwards_path = dubins_forwards_ss.integrate(start, dubins_forwards_controls_inter);
642  State dubins_forwards_state_inter = dubins_forwards_ss.interpolate(start, dubins_forwards_controls, t);
643  EXPECT_EQ(is_equal(dubins_forwards_path.back(), dubins_forwards_state_inter), true);
644 
645  vector<Control> cc00_rs_controls = cc00_rs_ss.get_controls(start, goal);
646  double cc00_rs_s_path = get_path_length(cc00_rs_controls);
647  double cc00_rs_s_inter = t * cc00_rs_s_path;
648  s = 0.0;
649  vector<Control> cc00_rs_controls_inter;
650  cc00_rs_controls_inter.reserve(cc00_rs_controls.size());
651  for (const auto& control : cc00_rs_controls)
652  {
653  double abs_delta_s = fabs(control.delta_s);
654  s += abs_delta_s;
655  if (s < cc00_rs_s_inter)
656  cc00_rs_controls_inter.push_back(control);
657  else
658  {
659  Control control_inter;
660  control_inter.delta_s = sgn(control.delta_s) * (abs_delta_s - (s - cc00_rs_s_inter));
661  control_inter.kappa = control.kappa;
662  control_inter.sigma = control.sigma;
663  cc00_rs_controls_inter.push_back(control_inter);
664  break;
665  }
666  }
667  vector<State> cc00_rs_path = cc00_rs_ss.integrate(start, cc00_rs_controls_inter);
668  State cc00_rs_state_inter = cc00_rs_ss.interpolate(start, cc00_rs_controls, t);
669  EXPECT_EQ(is_equal(cc00_rs_path.back(), cc00_rs_state_inter), true);
670 
671  vector<Control> hc_rs_controls = hc_rs_ss.get_controls(start, goal);
672  double hc_rs_s_path = get_path_length(hc_rs_controls);
673  double hc_rs_s_inter = t * hc_rs_s_path;
674  s = 0.0;
675  vector<Control> hc_rs_controls_inter;
676  hc_rs_controls_inter.reserve(hc_rs_controls.size());
677  for (const auto& control : hc_rs_controls)
678  {
679  double abs_delta_s = fabs(control.delta_s);
680  s += abs_delta_s;
681  if (s < hc_rs_s_inter)
682  hc_rs_controls_inter.push_back(control);
683  else
684  {
685  Control control_inter;
686  control_inter.delta_s = sgn(control.delta_s) * (abs_delta_s - (s - hc_rs_s_inter));
687  control_inter.kappa = control.kappa;
688  control_inter.sigma = control.sigma;
689  hc_rs_controls_inter.push_back(control_inter);
690  break;
691  }
692  }
693  vector<State> hc_rs_path = hc_rs_ss.integrate(start, hc_rs_controls_inter);
694  State hc_rs_state_inter = hc_rs_ss.interpolate(start, hc_rs_controls, t);
695  EXPECT_EQ(is_equal(hc_rs_path.back(), hc_rs_state_inter), true);
696 
697  vector<Control> hc00_rs_controls = hc00_rs_ss.get_controls(start, goal);
698  double hc00_rs_s_path = get_path_length(hc00_rs_controls);
699  double hc00_rs_s_inter = t * hc00_rs_s_path;
700  s = 0.0;
701  vector<Control> hc00_rs_controls_inter;
702  hc00_rs_controls_inter.reserve(hc00_rs_controls.size());
703  for (const auto& control : hc00_rs_controls)
704  {
705  double abs_delta_s = fabs(control.delta_s);
706  s += abs_delta_s;
707  if (s < hc00_rs_s_inter)
708  hc00_rs_controls_inter.push_back(control);
709  else
710  {
711  Control control_inter;
712  control_inter.delta_s = sgn(control.delta_s) * (abs_delta_s - (s - hc00_rs_s_inter));
713  control_inter.kappa = control.kappa;
714  control_inter.sigma = control.sigma;
715  hc00_rs_controls_inter.push_back(control_inter);
716  break;
717  }
718  }
719  vector<State> hc00_rs_path = hc00_rs_ss.integrate(start, hc00_rs_controls_inter);
720  State hc00_rs_state_inter = hc00_rs_ss.interpolate(start, hc00_rs_controls, t);
721  EXPECT_EQ(is_equal(hc00_rs_path.back(), hc00_rs_state_inter), true);
722 
723  vector<Control> hcpmpm_rs_controls = hcpmpm_rs_ss.get_controls(start, goal);
724  double hcpmpm_rs_s_path = get_path_length(hcpmpm_rs_controls);
725  double hcpmpm_rs_s_inter = t * hcpmpm_rs_s_path;
726  s = 0.0;
727  vector<Control> hcpmpm_rs_controls_inter;
728  hcpmpm_rs_controls_inter.reserve(hcpmpm_rs_controls.size());
729  for (const auto& control : hcpmpm_rs_controls)
730  {
731  double abs_delta_s = fabs(control.delta_s);
732  s += abs_delta_s;
733  if (s < hcpmpm_rs_s_inter)
734  hcpmpm_rs_controls_inter.push_back(control);
735  else
736  {
737  Control control_inter;
738  control_inter.delta_s = sgn(control.delta_s) * (abs_delta_s - (s - hcpmpm_rs_s_inter));
739  control_inter.kappa = control.kappa;
740  control_inter.sigma = control.sigma;
741  hcpmpm_rs_controls_inter.push_back(control_inter);
742  break;
743  }
744  }
745  vector<State> hcpmpm_rs_path = hcpmpm_rs_ss.integrate(start, hcpmpm_rs_controls_inter);
746  State hcpmpm_rs_state_inter = hcpmpm_rs_ss.interpolate(start, hcpmpm_rs_controls, t);
747  EXPECT_EQ(is_equal(hcpmpm_rs_path.back(), hcpmpm_rs_state_inter), true);
748 
749  vector<Control> rs_controls = rs_ss.get_controls(start, goal);
750  double rs_s_path = get_path_length(rs_controls);
751  double rs_s_inter = t * rs_s_path;
752  s = 0.0;
753  vector<Control> rs_controls_inter;
754  rs_controls_inter.reserve(rs_controls.size());
755  for (const auto& control : rs_controls)
756  {
757  double abs_delta_s = fabs(control.delta_s);
758  s += abs_delta_s;
759  if (s < rs_s_inter)
760  rs_controls_inter.push_back(control);
761  else
762  {
763  Control control_inter;
764  control_inter.delta_s = sgn(control.delta_s) * (abs_delta_s - (s - rs_s_inter));
765  control_inter.kappa = control.kappa;
766  control_inter.sigma = control.sigma;
767  rs_controls_inter.push_back(control_inter);
768  break;
769  }
770  }
771  vector<State> rs_path = rs_ss.integrate(start, rs_controls_inter);
772  State rs_state_inter = rs_ss.interpolate(start, rs_controls, t);
773  EXPECT_EQ(is_equal(rs_path.back(), rs_state_inter), true);
774  }
775 }
776 
777 TEST(SteeringFunctions, symmetry)
778 {
779  srand(seed);
780  for (int i = 0; i < SAMPLES; ++i)
781  {
783  State goal = get_random_state();
784 
785  double cc00_rs_distance_forwards = cc00_rs_ss.get_distance(start, goal);
786  double cc00_rs_distance_backwards = cc00_rs_ss.get_distance(goal, start);
787  EXPECT_LT(fabs(cc00_rs_distance_forwards - cc00_rs_distance_backwards), EPS_DISTANCE);
788 
789  double hc00_rs_distance_forwards = hc00_rs_ss.get_distance(start, goal);
790  double hc00_rs_distance_backwards = hc00_rs_ss.get_distance(goal, start);
791  EXPECT_LT(fabs(hc00_rs_distance_forwards - hc00_rs_distance_backwards), EPS_DISTANCE);
792 
793  double hcpmpm_rs_distance_forwards = hcpmpm_rs_ss.get_distance(start, goal);
794  double hcpmpm_rs_distance_backwards = hcpmpm_rs_ss.get_distance(goal, start);
795  EXPECT_LT(fabs(hcpmpm_rs_distance_forwards - hcpmpm_rs_distance_backwards), EPS_DISTANCE);
796 
797  double rs_distance_forwards = rs_ss.get_distance(start, goal);
798  double rs_distance_backwards = rs_ss.get_distance(goal, start);
799  EXPECT_LT(fabs(rs_distance_forwards - rs_distance_backwards), EPS_DISTANCE);
800  }
801 }
802 
803 int main(int argc, char** argv)
804 {
805  testing::InitGoogleTest(&argc, argv);
806  return RUN_ALL_TESTS();
807 }
is_equal
bool is_equal(const State &state1, const State &state2)
Definition: steering_functions_test.cpp:91
steering::CC00_Dubins_State_Space
An implementation of continuous curvature (CC) steer for a Dubins car with zero curvature at the star...
Definition: cc00_dubins_state_space.hpp:70
hc00_rs_ss
HC00_Reeds_Shepp_State_Space hc00_rs_ss(KAPPA, SIGMA, DISCRETIZATION)
steering::Dubins_State_Space::get_path
std::vector< State > get_path(const State &state1, const State &state2) const
Returns shortest path from state1 to state2 with curvature = kappa_.
Definition: dubins_state_space.cpp:291
steering::CC0pm_Dubins_State_Space
An implementation of continuous curvature (CC) steer for a Dubins car with zero curvature at the star...
Definition: cc0pm_dubins_state_space.hpp:69
dubins_backwards_ss
Dubins_State_Space dubins_backwards_ss(KAPPA, DISCRETIZATION, false)
steering::State
Description of a kinematic car's state.
Definition: steering_functions.hpp:44
steering::Dubins_State_Space
An SE(2) state space where distance is measured by the length of Dubins curves. Note that this Dubins...
Definition: dubins_state_space.hpp:141
OPERATING_REGION_Y
#define OPERATING_REGION_Y
Definition: steering_functions_test.cpp:47
steering::HC_CC_State_Space::get_path
std::vector< State > get_path(const State &state1, const State &state2) const
Returns path from state1 to state2.
Definition: hc_cc_state_space.cpp:68
reeds_shepp_state_space.hpp
steering::CC00_Dubins_State_Space::get_controls
std::vector< Control > get_controls(const State &state1, const State &state2) const
Returns controls of the shortest path from state1 to state2.
Definition: cc00_dubins_state_space.cpp:496
steering::CC0pm_Dubins_State_Space::get_distance
double get_distance(const State &state1, const State &state2) const
Returns shortest path length from state1 to state2.
Definition: cc0pm_dubins_state_space.cpp:508
steering::HCpmpm_Reeds_Shepp_State_Space
An implementation of hybrid curvature (HC) steer with either positive (p) or negative (n) max....
Definition: hcpmpm_reeds_shepp_state_space.hpp:74
steering::HC00_Reeds_Shepp_State_Space::get_controls
std::vector< Control > get_controls(const State &state1, const State &state2) const
Returns controls of the shortest path from state1 to state2.
Definition: hc00_reeds_shepp_state_space.cpp:1762
plot_states.path
path
Definition: plot_states.py:88
steering::Control::sigma
double sigma
Sharpness (derivative of curvature with respect to arc length) of a segment.
Definition: steering_functions.hpp:91
s
XmlRpcServer s
steering::HC00_Reeds_Shepp_State_Space
An implementation of hybrid curvature (HC) steer with zero curvature at the start and goal configurat...
Definition: hc00_reeds_shepp_state_space.hpp:73
steering::State::theta
double theta
Orientation of the robot.
Definition: steering_functions.hpp:70
main
int main(int argc, char **argv)
Definition: steering_functions_test.cpp:803
steering::CCpmpm_Dubins_State_Space::get_distance
double get_distance(const State &state1, const State &state2) const
Returns shortest path length from state1 to state2.
Definition: ccpmpm_dubins_state_space.cpp:653
SIGMA
#define SIGMA
Definition: steering_functions_test.cpp:43
time.h
get_distance
double get_distance(const State &state1, const State &state2)
Definition: steering_functions_test.cpp:66
random
#define random(lower, upper)
Definition: steering_functions_test.cpp:49
hcpmpm_rs_ss
HCpmpm_Reeds_Shepp_State_Space hcpmpm_rs_ss(KAPPA, SIGMA, DISCRETIZATION)
steering::Dubins_State_Space::interpolate
State interpolate(const State &state, const std::vector< Control > &controls, double t) const
Returns interpolated state at distance t in [0,1] (percent of total path length with curvature = kapp...
Definition: dubins_state_space.cpp:421
steering::HC0pm_Reeds_Shepp_State_Space
An implementation of hybrid curvature (HC) steer with zero curvature at the start configuration and e...
Definition: hc0pm_reeds_shepp_state_space.hpp:74
steering::Dubins_State_Space::get_controls
std::vector< Control > get_controls(const State &state1, const State &state2) const
Returns controls of the shortest path from state1 to state2 with curvature = kappa_.
Definition: dubins_state_space.cpp:249
steering::State::kappa
double kappa
Curvature at position (x,y)
Definition: steering_functions.hpp:73
steering::CC00_Reeds_Shepp_State_Space::get_controls
std::vector< Control > get_controls(const State &state1, const State &state2) const
Returns controls of the shortest path from state1 to state2.
Definition: cc00_reeds_shepp_state_space.cpp:1705
steering::HC_CC_State_Space::integrate
std::vector< State > integrate(const State &state, const std::vector< Control > &controls) const
Returns integrated states given a start state and controls.
Definition: hc_cc_state_space.cpp:81
steering::CC0pm_Dubins_State_Space::get_controls
std::vector< Control > get_controls(const State &state1, const State &state2) const
Returns controls of the shortest path from state1 to state2.
Definition: cc0pm_dubins_state_space.cpp:516
hc0pm_reeds_shepp_state_space.hpp
steering::CCpm0_Dubins_State_Space::get_distance
double get_distance(const State &state1, const State &state2) const
Returns shortest path length from state1 to state2.
Definition: ccpm0_dubins_state_space.cpp:507
steering::HCpm0_Reeds_Shepp_State_Space::get_distance
double get_distance(const State &state1, const State &state2) const
Returns shortest path length from state1 to state2.
Definition: hcpm0_reeds_shepp_state_space.cpp:1783
ccpm0_dubins_forwards_ss
CCpm0_Dubins_State_Space ccpm0_dubins_forwards_ss(KAPPA, SIGMA, DISCRETIZATION, true)
steering::CC_Dubins_State_Space
An implementation of continuous curvature (CC) steer for a Dubins car with arbitrary curvature at the...
Definition: cc_dubins_state_space.hpp:54
steering::HC_Reeds_Shepp_State_Space::get_controls
std::vector< Control > get_controls(const State &state1, const State &state2) const
Returns controls of the shortest path from state1 to state2.
Definition: hc_reeds_shepp_state_space.cpp:144
cc00_dubins_backwards_ss
CC00_Dubins_State_Space cc00_dubins_backwards_ss(KAPPA, SIGMA, DISCRETIZATION, false)
steering::State::y
double y
Position in y of the robot.
Definition: steering_functions.hpp:67
ccpm0_dubins_state_space.hpp
random_boolean
#define random_boolean()
Definition: steering_functions_test.cpp:50
steering::CC_Dubins_State_Space::get_distance
double get_distance(const State &state1, const State &state2) const
Returns shortest path length from state1 to state2.
Definition: cc_dubins_state_space.cpp:97
steering::Control::kappa
double kappa
Curvature at the beginning of a segment.
Definition: steering_functions.hpp:88
steering::HC_Reeds_Shepp_State_Space
An implementation of hybrid curvature (HC) steer with arbitrary curvature at the start and goal confi...
Definition: hc_reeds_shepp_state_space.hpp:53
steering::Control
Description of a path segment with its corresponding control inputs.
Definition: steering_functions.hpp:82
hcpm0_rs_ss
HCpm0_Reeds_Shepp_State_Space hcpm0_rs_ss(KAPPA, SIGMA, DISCRETIZATION)
cc0pm_dubins_backwards_ss
CC0pm_Dubins_State_Space cc0pm_dubins_backwards_ss(KAPPA, SIGMA, DISCRETIZATION, false)
SAMPLES
#define SAMPLES
Definition: steering_functions_test.cpp:45
KAPPA
#define KAPPA
Definition: steering_functions_test.cpp:42
steering::HC0pm_Reeds_Shepp_State_Space::get_distance
double get_distance(const State &state1, const State &state2) const
Returns shortest path length from state1 to state2.
Definition: hc0pm_reeds_shepp_state_space.cpp:1785
steering::Reeds_Shepp_State_Space::get_path
std::vector< State > get_path(const State &state1, const State &state2) const
Returns shortest path from state1 to state2 with curvature = kappa_.
Definition: reeds_shepp_state_space.cpp:580
steering::CC00_Reeds_Shepp_State_Space
An implementation of continuous curvature (CC) steer for a Reeds-Shepp car with zero curvature at the...
Definition: cc00_reeds_shepp_state_space.hpp:74
steering::Reeds_Shepp_State_Space::interpolate
State interpolate(const State &state, const std::vector< Control > &controls, double t) const
Returns interpolated state at distance t in [0,1] (percent of total path length with curvature = kapp...
Definition: reeds_shepp_state_space.cpp:710
steering::CCpm0_Dubins_State_Space::get_controls
std::vector< Control > get_controls(const State &state1, const State &state2) const
Returns controls of the shortest path from state1 to state2.
Definition: ccpm0_dubins_state_space.cpp:515
EPS_KAPPA
#define EPS_KAPPA
Definition: steering_functions_test.cpp:41
steering::HC_Reeds_Shepp_State_Space::get_distance
double get_distance(const State &state1, const State &state2) const
Returns shortest path length from state1 to state2.
Definition: hc_reeds_shepp_state_space.cpp:92
cc0pm_dubins_forwards_ss
CC0pm_Dubins_State_Space cc0pm_dubins_forwards_ss(KAPPA, SIGMA, DISCRETIZATION, true)
hc00_reeds_shepp_state_space.hpp
TEST
TEST(SteeringFunctions, pathLength)
Definition: steering_functions_test.cpp:122
seed
int seed(time(nullptr))
steering::State::x
double x
Position in x of the robot.
Definition: steering_functions.hpp:64
OPERATING_REGION_THETA
#define OPERATING_REGION_THETA
Definition: steering_functions_test.cpp:48
steering::HCpmpm_Reeds_Shepp_State_Space::get_controls
std::vector< Control > get_controls(const State &state1, const State &state2) const
Returns controls of the shortest path from state1 to state2.
Definition: hcpmpm_reeds_shepp_state_space.cpp:1839
dubins_forwards_ss
Dubins_State_Space dubins_forwards_ss(KAPPA, DISCRETIZATION, true)
get_path_length
double get_path_length(const vector< State > &path)
Definition: steering_functions_test.cpp:71
hcpm0_reeds_shepp_state_space.hpp
steering::CCpm0_Dubins_State_Space
An implementation of continuous curvature (CC) steer for a Dubins car with either positive (p) or neg...
Definition: ccpm0_dubins_state_space.hpp:69
steering::HCpm0_Reeds_Shepp_State_Space
An implementation of hybrid curvature (HC) steer with either positive (p) or negative (n) max....
Definition: hcpm0_reeds_shepp_state_space.hpp:74
steering::HC_CC_State_Space::interpolate
State interpolate(const State &state, const std::vector< Control > &controls, double t) const
Returns interpolated state at distance t in [0,1] (percentage of total path length)
Definition: hc_cc_state_space.cpp:212
steering::Reeds_Shepp_State_Space::get_controls
std::vector< Control > get_controls(const State &state1, const State &state2) const
Returns controls of the shortest path from state1 to state2 with curvature = kappa_.
Definition: reeds_shepp_state_space.cpp:547
ccpm0_dubins_backwards_ss
CCpm0_Dubins_State_Space ccpm0_dubins_backwards_ss(KAPPA, SIGMA, DISCRETIZATION, false)
EPS_DISTANCE
#define EPS_DISTANCE
Definition: steering_functions_test.cpp:39
steering::Control::delta_s
double delta_s
Signed arc length of a segment.
Definition: steering_functions.hpp:85
get_random_state
State get_random_state()
Definition: steering_functions_test.cpp:55
steering::CCpmpm_Dubins_State_Space::get_controls
std::vector< Control > get_controls(const State &state1, const State &state2) const
Returns controls of the shortest path from state1 to state2.
Definition: ccpmpm_dubins_state_space.cpp:661
steering::HC00_Reeds_Shepp_State_Space::get_distance
double get_distance(const State &state1, const State &state2) const
Returns shortest path length from state1 to state2.
Definition: hc00_reeds_shepp_state_space.cpp:1754
start
ROSCPP_DECL void start()
steering::CC00_Dubins_State_Space::get_distance
double get_distance(const State &state1, const State &state2) const
Returns shortest path length from state1 to state2.
Definition: cc00_dubins_state_space.cpp:488
cc00_dubins_forwards_ss
CC00_Dubins_State_Space cc00_dubins_forwards_ss(KAPPA, SIGMA, DISCRETIZATION, true)
hc_reeds_shepp_state_space.hpp
DISCRETIZATION
#define DISCRETIZATION
Definition: steering_functions_test.cpp:44
ccpmpm_dubins_backwards_ss
CCpmpm_Dubins_State_Space ccpmpm_dubins_backwards_ss(KAPPA, SIGMA, DISCRETIZATION, false)
steering::HCpmpm_Reeds_Shepp_State_Space::get_distance
double get_distance(const State &state1, const State &state2) const
Returns shortest path length from state1 to state2.
Definition: hcpmpm_reeds_shepp_state_space.cpp:1831
std
steering_functions.hpp
EPS_YAW
#define EPS_YAW
Definition: steering_functions_test.cpp:40
hc0pm_rs_ss
HC0pm_Reeds_Shepp_State_Space hc0pm_rs_ss(KAPPA, SIGMA, DISCRETIZATION)
steering::Reeds_Shepp_State_Space
An SE(2) state space where distance is measured by the length of Reeds-Shepp curves....
Definition: reeds_shepp_state_space.hpp:141
ccpmpm_dubins_state_space.hpp
steering::Dubins_State_Space::integrate
std::vector< State > integrate(const State &state, const std::vector< Control > &controls) const
Returns integrated states given a start state and controls with curvature = kappa_.
Definition: dubins_state_space.cpp:304
steering
Definition: dubins_state_space.hpp:70
OPERATING_REGION_X
#define OPERATING_REGION_X
Definition: steering_functions_test.cpp:46
hcpmpm_reeds_shepp_state_space.hpp
cc00_dubins_state_space.hpp
steering::sgn
double sgn(double x)
Return sign of a number.
Definition: utilities.cpp:62
cc_dubins_backwards_ss
CC_Dubins_State_Space cc_dubins_backwards_ss(KAPPA, SIGMA, DISCRETIZATION, false)
cc00_reeds_shepp_state_space.hpp
steering::State::d
double d
Definition: steering_functions.hpp:76
cc00_rs_ss
CC00_Reeds_Shepp_State_Space cc00_rs_ss(KAPPA, SIGMA, DISCRETIZATION)
dubins_state_space.hpp
steering::CC00_Reeds_Shepp_State_Space::get_distance
double get_distance(const State &state1, const State &state2) const
Returns shortest path length from state1 to state2.
Definition: cc00_reeds_shepp_state_space.cpp:1697
cc_dubins_state_space.hpp
steering::CC_Dubins_State_Space::get_controls
std::vector< Control > get_controls(const State &state1, const State &state2) const
Returns controls of the shortest path from state1 to state2.
Definition: cc_dubins_state_space.cpp:149
rs_ss
Reeds_Shepp_State_Space rs_ss(KAPPA, DISCRETIZATION)
t
geometry_msgs::TransformStamped t
utilities.hpp
cc_dubins_forwards_ss
CC_Dubins_State_Space cc_dubins_forwards_ss(KAPPA, SIGMA, DISCRETIZATION, true)
steering::Reeds_Shepp_State_Space::get_distance
double get_distance(const State &state1, const State &state2) const
Returns shortest path length from state1 to state2 with curvature = kappa_.
Definition: reeds_shepp_state_space.cpp:542
steering::Dubins_State_Space::get_distance
double get_distance(const State &state1, const State &state2) const
Returns shortest path length from state1 to state2 with curvature = kappa_.
Definition: dubins_state_space.cpp:241
steering::CCpmpm_Dubins_State_Space
An implementation of continuous curvature (CC) steer for a Dubins car with either positive (p) or neg...
Definition: ccpmpm_dubins_state_space.hpp:70
hc_rs_ss
HC_Reeds_Shepp_State_Space hc_rs_ss(KAPPA, SIGMA, DISCRETIZATION)
steering::Reeds_Shepp_State_Space::integrate
std::vector< State > integrate(const State &state, const std::vector< Control > &controls) const
Returns integrated states given a start state and controls with curvature = kappa_.
Definition: reeds_shepp_state_space.cpp:593
cc0pm_dubins_state_space.hpp
ccpmpm_dubins_forwards_ss
CCpmpm_Dubins_State_Space ccpmpm_dubins_forwards_ss(KAPPA, SIGMA, DISCRETIZATION, true)


steering_functions
Author(s): Holger Banzhaf
autogenerated on Mon Dec 11 2023 03:27:44