@@ -235,6 +235,7 @@ class PubSubNode : public rclcpp::Node
235
235
double lon_vel = 0.0 ;
236
236
double prev_lon_acc = 0.0 ;
237
237
double prev_lat_acc = 0.0 ;
238
+ // TODO(Horibe): Remove this variable when the filtering logic is fixed.
238
239
double prev_tire_angle = 0.0 ;
239
240
240
241
auto calculate_lateral_acceleration =
@@ -248,10 +249,10 @@ class PubSubNode : public rclcpp::Node
248
249
prev_lon_acc = cmd_start->longitudinal .acceleration ;
249
250
// TODO(Horibe): prev_lat_acc should use the previous velocity, but use the current velocity
250
251
// since the current filtering logic uses the current velocity.
252
+ // when it's fixed, should be like this:
253
+ // prev_lat_acc = calculate_lateral_acceleration(cmd_start->longitudinal.speed,
254
+ // cmd_start->lateral.steering_tire_angle, wheelbase);
251
255
prev_tire_angle = cmd_start->lateral .steering_tire_angle ;
252
- lon_vel = cmd_start->longitudinal .speed ;
253
- prev_lat_acc =
254
- calculate_lateral_acceleration (lon_vel, cmd_start->lateral .steering_tire_angle , wheelbase);
255
256
}
256
257
257
258
for (size_t i = ind_start; i < history_size; ++i) {
@@ -269,6 +270,7 @@ class PubSubNode : public rclcpp::Node
269
270
calculate_lateral_acceleration (lon_vel, cmd->lateral .steering_tire_angle , wheelbase);
270
271
// TODO(Horibe): prev_lat_acc should use the previous velocity, but use the current velocity
271
272
// since the current filtering logic uses the current velocity.
273
+ // when it's fixed, it should be moved to the bottom of this loop.
272
274
prev_lat_acc = calculate_lateral_acceleration (lon_vel, prev_tire_angle, wheelbase);
273
275
const auto lat_jerk = (lat_acc - prev_lat_acc) / dt;
274
276
@@ -278,8 +280,7 @@ class PubSubNode : public rclcpp::Node
278
280
avg_lat_jerk += lat_jerk;
279
281
280
282
prev_lon_acc = lon_acc;
281
- // TODO(Horibe): prev_lat_acc should use the previous velocity, but use the current velocity
282
- // since the current filtering logic uses the current velocity.
283
+ // TODO(Horibe): when the filtering logic is fixed, this line should be removed.
283
284
prev_tire_angle = cmd->lateral .steering_tire_angle ;
284
285
}
285
286
0 commit comments