ApolloAuto / apollo

An open autonomous driving platform
Apache License 2.0
24.98k stars 9.66k forks source link

Cost Evaluator - Front Lateral Distacne Cost #5882

Closed BoChang11 closed 2 years ago

BoChang11 commented 5 years ago

Hi,

I have been going through Cost evaluator and having hard time in understanding how the front lateral distance cost is calculated in the below code snippet.

double CostEvaluator::FrontLateralDistanceCost(
    const double obstacle_length, const double obstacle_width,
    const LaneSequence& lane_sequence) {
  if (lane_sequence.lane_segment_size() == 0 ||
      lane_sequence.lane_segment(0).lane_point_size() == 0) {
    AWARN << "Empty lane sequence.";
    return 0.0;
  }
  const LanePoint& lane_point = lane_sequence.lane_segment(0).lane_point(0);
  double lane_l = -lane_point.relative_l();
  ADEBUG << "Cost Evaluator - lane_l value : " << lane_l;
  double distance = std::abs(
      lane_l - obstacle_length / 2.0 * std::sin(lane_point.angle_diff()));
  ADEBUG << "Cost Evaluator - distance : " << distance;
  double half_lane_width = lane_point.width() / 2.0;
  ADEBUG << "Cost Evaluator - Half Lane Width : " << half_lane_width;
  double temp = half_lane_width - distance;
  ADEBUG << "Cost Evaluator - Return half_lane_width : " << temp; 
  return half_lane_width - distance;
}

Could you please give more explanation on this. For example Mathematical formulae/proof, reference paper used to implement the prediction module.

BR, Chang

daohu527 commented 2 years ago

Closed due to inactivity. If the problem persists, pls feel free to reopen it or create a new one and refer to it.