diff --git a/modules/planning/pipeline/feature_generator.cc b/modules/planning/pipeline/feature_generator.cc index cb798c4421edcc8b364b16b492da3552f7e4a8a5..1704aa46181df2817abb876c25dc650f24f416d9 100644 --- a/modules/planning/pipeline/feature_generator.cc +++ b/modules/planning/pipeline/feature_generator.cc @@ -98,18 +98,11 @@ void FeatureGenerator::OnLocalization( } void FeatureGenerator::OnChassis(const apollo::canbus::Chassis& chassis) { - /* To be fixed - if (learning_data_frame_ == nullptr) { - AERROR << "learning_data_frame_ pointer is nullptr"; - return; - } - auto features = learning_data_frame_->mutable_chassis(); - features->set_speed_mps(chassis.speed_mps()); - features->set_throttle_percentage(chassis.throttle_percentage()); - features->set_brake_percentage(chassis.brake_percentage()); - features->set_steering_percentage(chassis.steering_percentage()); - features->set_gear_location(chassis.gear_location()); - */ + chassis_feature_.set_speed_mps(chassis.speed_mps()); + chassis_feature_.set_throttle_percentage(chassis.throttle_percentage()); + chassis_feature_.set_brake_percentage(chassis.brake_percentage()); + chassis_feature_.set_steering_percentage(chassis.steering_percentage()); + chassis_feature_.set_gear_location(chassis.gear_location()); } void FeatureGenerator::OnTafficLightDetection( @@ -187,6 +180,10 @@ void FeatureGenerator::GenerateLearningDataFrame() { localization_for_label_.back().header().timestamp_sec()); learning_data_frame->set_frame_num(total_learning_data_frame_num_++); + // add chassis + auto chassis = learning_data_frame->mutable_chassis(); + chassis->CopyFrom(chassis_feature_); + // add localization auto localization = learning_data_frame->mutable_localization(); const auto& pose = localization_for_label_.back().pose(); diff --git a/modules/planning/pipeline/feature_generator.h b/modules/planning/pipeline/feature_generator.h index 9800c369ea44c0603b4fff5894ec9e20bf36eb76..ca5b20c110ef4b23b547edc9eab50589e4729ab2 100644 --- a/modules/planning/pipeline/feature_generator.h +++ b/modules/planning/pipeline/feature_generator.h @@ -61,6 +61,7 @@ class FeatureGenerator { std::list localization_for_label_; int total_learning_data_frame_num_ = 0; + ChassisFeature chassis_feature_; std::vector routing_lane_ids_; std::unordered_map traffic_lights_;