63 {
64 double t = 0.0;
65 while (t < lon_trajectory.ParamLength()) {
66 double s = lon_trajectory.Evaluate(0, t);
67 double dd_ds = lat_trajectory.Evaluate(1, s);
68 double ds_dt = lon_trajectory.Evaluate(1, t);
69
70 double d2d_ds2 = lat_trajectory.Evaluate(2, s);
71 double d2s_dt2 = lon_trajectory.Evaluate(2, t);
72
73 double a = 0.0;
74 if (s < lat_trajectory.ParamLength()) {
75 a = d2d_ds2 * ds_dt * ds_dt + dd_ds * d2s_dt2;
76 }
77
78 if (!fuzzy_within(a, -FLAGS_lateral_acceleration_bound,
79 FLAGS_lateral_acceleration_bound)) {
80 return false;
81 }
82
83
84 double j = 0.0;
85 if (s < lat_trajectory.ParamLength()) {
86 j = lat_trajectory.Evaluate(3, s) * lon_trajectory.Evaluate(3, t);
87 }
88
89 if (!fuzzy_within(j, -FLAGS_lateral_jerk_bound, FLAGS_lateral_jerk_bound)) {
90 return false;
91 }
92 t += FLAGS_trajectory_time_resolution;
93 }
94 return true;
95}