Skip to content

Commit

Permalink
adds: timer to NAV loop
Browse files Browse the repository at this point in the history
  • Loading branch information
rohitdwivedula committed Sep 27, 2024
1 parent ad57395 commit da99206
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 2 deletions.
18 changes: 16 additions & 2 deletions src/navigation/navigation.cc
Original file line number Diff line number Diff line change
Expand Up @@ -831,7 +831,7 @@ vector<GraphDomain::State> Navigation::GetPlanPath() {
return plan_path_;
}

bool Navigation::Run(const double& time,
bool Navigation::RunInternal(const double& time,
Vector2f& cmd_vel,
float& cmd_angle_vel) {
const bool kDebug = FLAGS_v > 0;
Expand Down Expand Up @@ -956,4 +956,18 @@ bool Navigation::Run(const double& time,
return true;
}

} // namespace navigation
bool Navigation::Run(const double& time, Vector2f& cmd_vel, float& cmd_angle_vel) {
auto start_run_loop = std::chrono::system_clock::now();
bool retval = Navigation::RunInternal(time, cmd_vel, cmd_angle_vel);
auto end_run_loop = std::chrono::system_clock::now();
std::chrono::duration<double, std::milli> time_diff = end_run_loop - start_run_loop;

printf(
"LOOP: %ld,%f\n",
std::chrono::duration_cast<std::chrono::milliseconds>(start_run_loop.time_since_epoch()).count(),
time_diff.count()
);
return retval;
}

} // namespace navigation
2 changes: 2 additions & 0 deletions src/navigation/navigation.h
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,8 @@ class Navigation {
double time);
void ObserveImage(cv::Mat image, double time);
bool Run(const double& time, Eigen::Vector2f& cmd_vel, float& cmd_angle_vel);
bool RunInternal(const double& time, Eigen::Vector2f& cmd_vel, float& cmd_angle_vel);

void GetStraightFreePathLength(float* free_path_length,
float* clearance);
void GetFreePathLength(float curvature,
Expand Down

0 comments on commit da99206

Please sign in to comment.