This commit is contained in:
HiepLM 2025-12-16 15:13:07 +07:00
parent e80eddc2c2
commit fdfba18bde

View File

@ -35,6 +35,7 @@
* Author: Eitan Marder-Eppstein * Author: Eitan Marder-Eppstein
* David V. Lu!! * David V. Lu!!
*********************************************************************/ *********************************************************************/
#include <robot/console.h>
#include <cstdio> #include <cstdio>
#include <string> #include <string>
#include <algorithm> #include <algorithm>
@ -105,20 +106,20 @@ void Costmap2DROBOT::getParams(const std::string& config_file_name, robot::NodeH
robot::Time last_error = robot::Time::now(); robot::Time last_error = robot::Time::now();
std::string tf_error; std::string tf_error;
// // we need to make sure that the transform between the robot base frame and the global frame is available // we need to make sure that the transform between the robot base frame and the global frame is available
// while (!tf_.canTransform(global_frame_, robot_base_frame_, tf3::Time::now(), &tf_error)) while (!tf_.canTransform(global_frame_, robot_base_frame_, tf3::Time::now(), &tf_error))
// { {
// if (last_error + robot::Duration(5.0) < robot::Time::now()) if (last_error + robot::Duration(5.0) < robot::Time::now())
// { {
// // std::cout << std::fixed << std::setprecision(6) << robot::Time::now().toSec() << std::endl; // std::cout << std::fixed << std::setprecision(6) << robot::Time::now().toSec() << std::endl;
// printf("%0.6f: Timed out waiting for transform from %s to %s to become available before running costmap, tf error: %s\n", robot::log_warning("[%s:%d] %0.6f: Timed out waiting for transform from %s to %s to become available before running costmap, tf error: %s\n",
// robot::Time::now().toSec(), robot_base_frame_.c_str(), global_frame_.c_str(), tf_error.c_str()); __FILE__, __LINE__, robot::Time::now().toSec(), robot_base_frame_.c_str(), global_frame_.c_str(), tf_error.c_str());
// last_error = robot::Time::now(); last_error = robot::Time::now();
// } }
// // The error string will accumulate and errors will typically be the same, so the last // The error string will accumulate and errors will typically be the same, so the last
// // will do for the warning above. Reset the string here to avoid accumulation. // will do for the warning above. Reset the string here to avoid accumulation.
// tf_error.clear(); tf_error.clear();
// } }
// check if we want a rolling window version of the costmap // check if we want a rolling window version of the costmap
bool rolling_window = loadParam(layer, "rolling_window", false); bool rolling_window = loadParam(layer, "rolling_window", false);