Skip to content
Snippets Groups Projects
Commit a250b702 authored by Joan Vallvé Navarro's avatar Joan Vallvé Navarro
Browse files

printing time spend in covariance computation

parent 76b26578
No related branches found
No related tags found
3 merge requests!11new release,!10new release,!4Gauss
...@@ -98,11 +98,13 @@ void WolfRosNode::solve() ...@@ -98,11 +98,13 @@ void WolfRosNode::solve()
if (compute_cov_ and (ros::Time::now() - last_cov_stamp_).toSec() > cov_period_) if (compute_cov_ and (ros::Time::now() - last_cov_stamp_).toSec() > cov_period_)
{ {
auto start = std::chrono::high_resolution_clock::now();
if (solver_->computeCovariances(cov_enum_)) if (solver_->computeCovariances(cov_enum_))
{ {
auto duration = std::chrono::duration_cast<std::chrono::microseconds>(std::chrono::high_resolution_clock::now() - start);
last_cov_stamp_ = ros::Time::now(); last_cov_stamp_ = ros::Time::now();
if (solver_->getVerbosity() != SolverManager::ReportVerbosity::QUIET) if (solver_->getVerbosity() != SolverManager::ReportVerbosity::QUIET)
ROS_INFO("Covariances computed successfully!"); ROS_INFO("Covariances computed successfully! It took %li microseconds", duration.count());
} }
else if (solver_->getVerbosity() != SolverManager::ReportVerbosity::QUIET) else if (solver_->getVerbosity() != SolverManager::ReportVerbosity::QUIET)
ROS_WARN("Failed to compute covariances"); ROS_WARN("Failed to compute covariances");
...@@ -230,6 +232,12 @@ int main(int argc, char **argv) ...@@ -230,6 +232,12 @@ int main(int argc, char **argv)
// Solver thread // Solver thread
std::thread solver_thread(&WolfRosNode::solveLoop, &wolf_node); std::thread solver_thread(&WolfRosNode::solveLoop, &wolf_node);
// set priority
struct sched_param Priority_Param; //struct to set priority
int priority = 99;
Priority_Param.sched_priority = priority;
int policy=SCHED_FIFO;
pthread_setschedparam(solver_thread.native_handle(), SCHED_FIFO, &Priority_Param);
while (ros::ok()) while (ros::ok())
{ {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment