提交 907bd777 编写于 作者: F fanhaoyang01 提交者: Dong Li

feature : add clear function for path data and speed data

上级 0176059b
...@@ -90,6 +90,11 @@ bool PathData::get_path_point_with_ref_s( ...@@ -90,6 +90,11 @@ bool PathData::get_path_point_with_ref_s(
return true; return true;
} }
void PathData::Clear() {
discretized_path_ = DiscretizedPath();
frenet_path_ = FrenetFramePath();
}
std::string PathData::DebugString() const { std::string PathData::DebugString() const {
std::ostringstream sout; std::ostringstream sout;
sout << "[" << std::endl; sout << "[" << std::endl;
......
...@@ -49,9 +49,10 @@ class PathData { ...@@ -49,9 +49,10 @@ class PathData {
bool get_path_point_with_ref_s(const double ref_s, bool get_path_point_with_ref_s(const double ref_s,
common::PathPoint *const path_point) const; common::PathPoint *const path_point) const;
void Clear();
std::string DebugString() const; std::string DebugString() const;
// TODO(fanhaoyang) add check if the path data is valid
private: private:
DiscretizedPath discretized_path_; DiscretizedPath discretized_path_;
......
...@@ -88,6 +88,10 @@ double SpeedData::total_time() const { ...@@ -88,6 +88,10 @@ double SpeedData::total_time() const {
return speed_vector_.back().t() - speed_vector_.front().t(); return speed_vector_.back().t() - speed_vector_.front().t();
} }
void SpeedData::Clear() {
speed_vector_.clear();
}
std::string SpeedData::DebugString() const { std::string SpeedData::DebugString() const {
std::ostringstream sout; std::ostringstream sout;
sout << "[" << std::endl; sout << "[" << std::endl;
......
...@@ -48,6 +48,7 @@ class SpeedData { ...@@ -48,6 +48,7 @@ class SpeedData {
double total_time() const; double total_time() const;
void Clear();
private: private:
SpeedPoint interpolate(const SpeedPoint& left, const SpeedPoint& right, SpeedPoint interpolate(const SpeedPoint& left, const SpeedPoint& right,
const double weight) const; const double weight) const;
......
...@@ -50,7 +50,7 @@ void PublishableTrajectory::set_header_time(const double header_time) { ...@@ -50,7 +50,7 @@ void PublishableTrajectory::set_header_time(const double header_time) {
ADCTrajectory PublishableTrajectory::to_trajectory_protobuf() const { ADCTrajectory PublishableTrajectory::to_trajectory_protobuf() const {
ADCTrajectory trajectory_pb; ADCTrajectory trajectory_pb;
trajectory_pb.mutable_header()->set_timestamp_sec(_header_time); trajectory_pb.mutable_header()->set_timestamp_sec(_header_time);
trajectory_pb.mutable_trajectory_point()->MergeFrom( trajectory_pb.mutable_trajectory_point()->CopyFrom(
{_trajectory_points.begin(), _trajectory_points.end()}); {_trajectory_points.begin(), _trajectory_points.end()});
return trajectory_pb; return trajectory_pb;
} }
...@@ -58,7 +58,7 @@ ADCTrajectory PublishableTrajectory::to_trajectory_protobuf() const { ...@@ -58,7 +58,7 @@ ADCTrajectory PublishableTrajectory::to_trajectory_protobuf() const {
void PublishableTrajectory::populate_trajectory_protobuf( void PublishableTrajectory::populate_trajectory_protobuf(
ADCTrajectory* trajectory_pb) const { ADCTrajectory* trajectory_pb) const {
trajectory_pb->mutable_header()->set_timestamp_sec(_header_time); trajectory_pb->mutable_header()->set_timestamp_sec(_header_time);
trajectory_pb->mutable_trajectory_point()->MergeFrom( trajectory_pb->mutable_trajectory_point()->CopyFrom(
{_trajectory_points.begin(), _trajectory_points.end()}); {_trajectory_points.begin(), _trajectory_points.end()});
} }
......
planner_type : EM em_planner_config { planner_type : EM em_planner_config {
optimizer : DP_POLY_PATH_OPTIMIZER optimizer : DP_POLY_PATH_OPTIMIZER
#optimizer : DP_ST_SPEED_OPTIMIZER optimizer : DP_ST_SPEED_OPTIMIZER
#optimizer : QP_SPLINE_PATH_OPTIMIZER optimizer : QP_SPLINE_PATH_OPTIMIZER
optimizer : QP_SPLINE_ST_SPEED_OPTIMIZER optimizer : QP_SPLINE_ST_SPEED_OPTIMIZER
} }
...@@ -80,6 +80,7 @@ Status QpSplineStGraph::search(const StGraphData& st_graph_data, ...@@ -80,6 +80,7 @@ Status QpSplineStGraph::search(const StGraphData& st_graph_data,
} }
// extract output // extract output
speed_data->Clear();
const Spline1d& spline = _spline_generator->spline(); const Spline1d& spline = _spline_generator->spline();
double time_resolution = _qp_spline_st_speed_config.output_time_resolution(); double time_resolution = _qp_spline_st_speed_config.output_time_resolution();
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册