提交 b02875c3 编写于 作者: D Dong Li 提交者: Jiangtao Hu

planning: support running in profiling mode

上级 b54e8842
......@@ -18,6 +18,10 @@
DEFINE_bool(planning_test_mode, false, "Enable planning test mode.");
DEFINE_double(test_duration, -1.0,
"The runtime duration in test mode. There is no runtime limit if "
"the value is not positive");
DEFINE_int32(planning_loop_rate, 10, "Loop rate for planning node");
DEFINE_string(planning_adapter_config_filename,
......
......@@ -20,6 +20,7 @@
#include "gflags/gflags.h"
DECLARE_bool(planning_test_mode);
DECLARE_double(test_duration);
DECLARE_string(planning_config_file);
DECLARE_string(planning_adapter_config_filename);
......
......@@ -135,11 +135,18 @@ Status Planning::Start() {
timer_ = AdapterManager::CreateTimer(
ros::Duration(1.0 / FLAGS_planning_loop_rate), &Planning::OnTimer, this);
ReferenceLineProvider::instance()->Start();
start_time_ = Clock::NowInSeconds();
AINFO << "Planning started";
return Status::OK();
}
void Planning::OnTimer(const ros::TimerEvent&) { RunOnce(); }
void Planning::OnTimer(const ros::TimerEvent&) {
RunOnce();
if (FLAGS_planning_test_mode && FLAGS_test_duration > 0.0 &&
Clock::NowInSeconds() - start_time_ > FLAGS_test_duration) {
ros::shutdown();
}
}
void Planning::PublishPlanningPb(ADCTrajectory* trajectory_pb,
double timestamp) {
......
......@@ -107,6 +107,8 @@ class Planning : public PlanningInterface {
bool IsVehicleStateValid(const common::VehicleState& vehicle_state);
void ExportReferenceLineDebug(planning_internal::Debug* debug);
double start_time_ = 0.0;
apollo::common::util::Factory<PlanningConfig::PlannerType, Planner>
planner_factory_;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册