Go to the documentation of this file.
28 HC_CC_State_Space::HC_CC_State_Space(
double kappa,
double sigma,
double discretization)
29 : kappa_(
kappa), sigma_(sigma), discretization_(discretization)
32 assert(
kappa > 0.0 && sigma > 0.0 && discretization > 0.0);
34 double length_min =
kappa / sigma;
35 double x_i, y_i, theta_i;
39 end_of_clothoid(0, 0, 0, 0, sigma, 1, length_min, &x_i, &y_i, &theta_i, &kappa_i);
49 xc = x_i - sin(theta_i) /
kappa;
50 yc = y_i + cos(theta_i) /
kappa;
53 double mu = atan(fabs(xc / yc));
54 double sin_mu = sin(mu);
55 double cos_mu = cos(mu);
57 double delta_min = 0.5 * pow(
kappa, 2) / sigma;
75 const State &state2)
const
84 State state_curr, state_next;
87 for (
const auto &control : controls)
89 double abs_delta_s(fabs(control.delta_s));
92 path.reserve(n_states + 3);
94 state_curr.
x = state.
x;
95 state_curr.
y = state.
y;
97 state_curr.
kappa = controls.front().kappa;
98 state_curr.
d =
sgn(controls.front().delta_s);
99 path.push_back(state_curr);
101 for (
const auto &control : controls)
103 double delta_s(control.delta_s);
104 double abs_delta_s(fabs(delta_s));
105 double kappa(control.kappa);
107 double integration_step(0.0);
112 state_curr.
d =
sgn(delta_s);
113 path.push_back(state_curr);
120 if (s_seg > abs_delta_s)
129 state_next =
integrate_ODE(state_curr, control, integration_step);
130 path.push_back(state_next);
131 state_curr = state_next;
138 const vector<Control> &controls)
const
140 vector<State_With_Covariance> path_with_covariance;
144 for (
const auto &control : controls)
146 double abs_delta_s(fabs(control.delta_s));
149 path_with_covariance.reserve(n_states + 3);
154 state_curr.
state.
kappa = controls.front().kappa;
155 state_curr.
state.
d =
sgn(controls.front().delta_s);
156 for (
int i = 0; i < 16; i++)
162 path_with_covariance.push_back(state_curr);
164 for (
const auto &control : controls)
166 double delta_s(control.delta_s);
167 double abs_delta_s(fabs(delta_s));
168 double kappa(control.kappa);
170 double integration_step(0.0);
176 path_with_covariance.push_back(state_curr);
183 if (s_seg > abs_delta_s)
194 ekf_.
predict(state_curr, control, integration_step, state_pred);
199 path_with_covariance.push_back(state_next);
201 for (
int i = 0; i < 16; i++)
209 return path_with_covariance;
214 State state_curr, state_next;
216 state_curr.
x = state.
x;
217 state_curr.
y = state.
y;
219 state_curr.
kappa = controls.front().kappa;
220 state_curr.
d =
sgn(controls.front().delta_s);
224 for (
const auto &control : controls)
226 s_path += fabs(control.delta_s);
233 s_inter =
t * s_path;
236 bool interpolated =
false;
237 for (
const auto &control : controls)
242 double delta_s(control.delta_s);
243 double abs_delta_s(fabs(delta_s));
244 double kappa(control.kappa);
246 double integration_step(0.0);
251 state_curr.
d =
sgn(delta_s);
257 abs_delta_s = abs_delta_s - (
s - s_inter);
265 if (s_seg > abs_delta_s)
274 state_next =
integrate_ODE(state_curr, control, integration_step);
275 state_curr = state_next;
284 double sigma(control.
sigma);
289 &state_next.
y, &state_next.
theta, &state_next.
kappa);
State state
Expected state of the robot.
double covariance[16]
Covariance of the state given by Sigma + Lambda: (x_x x_y x_theta x_kappa y_x y_y y_theta y_kappa the...
HC_CC_Circle_Param hc_cc_circle_param_
Parameters of a hc-/cc-circle.
Description of a kinematic car's state.
double point_distance(double x1, double y1, double x2, double y2)
Cartesian distance between two points.
std::vector< State > get_path(const State &state1, const State &state2) const
Returns path from state1 to state2.
double sigma
Sharpness (derivative of curvature with respect to arc length) of a segment.
double theta
Orientation of the robot.
double Sigma[16]
Covariance of the state estimation due to motion and measurement noise.
std::vector< State_With_Covariance > get_path_with_covariance(const State_With_Covariance &state1, const State &state2) const
Returns path including covariances from state1 to state2.
double kappa
Curvature at position (x,y)
void end_of_straight_line(double x_i, double y_i, double theta, double direction, double length, double *x_f, double *y_f)
Computation of the end point on a straight line x_i, y_i: initial configuration theta: angle of strai...
std::vector< State > integrate(const State &state, const std::vector< Control > &controls) const
Returns integrated states given a start state and controls.
EKF ekf_
Extended Kalman Filter for uncertainty propagation.
double y
Position in y of the robot.
Description of a path segment with its corresponding control inputs.
void update(const State_With_Covariance &state_pred, State_With_Covariance &state_corr) const
Predicts the covariances.
void set_parameters(const Motion_Noise &motion_noise, const Measurement_Noise &measurement_noise, const Controller &_controller)
Sets the parameters required by the EKF.
State integrate_ODE(const State &state, const Control &control, double integration_step) const
Returns integrated state given a start state, a control, and an integration step.
void set_param(double _kappa, double _sigma, double _radius, double _mu, double _sin_mu, double _cos_mu, double _delta_min)
Set parameters.
void set_filter_parameters(const Motion_Noise &motion_noise, const Measurement_Noise &measurement_noise, const Controller &controller)
Sets the parameters required by the filter.
Parameters of the motion noise model according to the book: Probabilistic Robotics,...
void end_of_circular_arc(double x_i, double y_i, double theta_i, double kappa, double direction, double length, double *x_f, double *y_f, double *theta_f)
Computation of the end point on a circular arc x_i, y_i, theta_i: initial configuration kappa: curvat...
double x
Position in x of the robot.
void predict(const State_With_Covariance &state, const Control &control, double integration_step, State_With_Covariance &state_pred) const
Predicts the covariances based on the paper: Rapidly-exploring random belief trees for motion plannin...
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)
double delta_s
Signed arc length of a segment.
double Lambda[16]
Covariance of the state estimate due to the absence of measurements.
virtual std::vector< Control > get_controls(const State &state1, const State &state2) const =0
Virtual function that returns controls of the shortest path from state1 to state2.
double discretization_
Discretization of path.
void end_of_clothoid(double x_i, double y_i, double theta_i, double kappa_i, double sigma, double direction, double length, double *x_f, double *y_f, double *theta_f, double *kappa_f)
Computation of the end point on a clothoid x_i, y_i, theta_i, kappa_i: initial configuration sigma: s...
double get_epsilon()
Return value of epsilon.
Description of a kinematic car's state with covariance.
Parameters of the feedback controller.
double sgn(double x)
Return sign of a number.
std::vector< State_With_Covariance > integrate_with_covariance(const State_With_Covariance &state, const std::vector< Control > &controls) const
Returns integrated states including covariance given a start state and controls.
geometry_msgs::TransformStamped t
Parameters of the measurement noise.