DuongTD gui zalo

This commit is contained in:
2026-01-10 10:16:51 +07:00
parent 384897b750
commit b66bd7c751
4 changed files with 29 additions and 28 deletions

View File

@@ -102,6 +102,7 @@ void Costmap2DROBOT::getParams(const std::string& config_file_name, robot::NodeH
global_frame_ = global_frame;
robot_base_frame_ = robot_base_frame;
robot::log_error("robot_base_frame: %s", robot_base_frame.c_str());
robot::Time last_error = robot::Time::now();
std::string tf_error;
@@ -137,8 +138,33 @@ void Costmap2DROBOT::getParams(const std::string& config_file_name, robot::NodeH
if (nh.hasParam("library_path"))
path_plugins = loader.findLibraryPath(name_);
robot::log_error("name: %s | rolling_window: %x", name_.c_str(), rolling_window);
layered_costmap_ = new LayeredCostmap(global_frame_, rolling_window, track_unknown_space);
// find size parameters
double map_width_meters = loadParam(layer, "width", 0.0);
double map_height_meters = loadParam(layer, "height", 0.0);
double resolution = loadParam(layer, "resolution", 0.0);
double origin_x = loadParam(layer, "origin_x", 0.0);
double origin_y = loadParam(layer, "origin_y", 0.0);
if (nh.hasParam("width"))
nh.getParam("width", map_width_meters);
if (nh.hasParam("height"))
nh.getParam("height", map_height_meters);
if (nh.hasParam("resolution"))
nh.getParam("resolution", resolution);
if (nh.hasParam("origin_x"))
nh.getParam("origin_x", origin_x);
if (nh.hasParam("origin_y"))
nh.getParam("origin_y", origin_y);
if (!layered_costmap_->isSizeLocked())
{
// robot::log_warning("ROBOT origin_x: %f | origin_y: %f", origin_x, origin_y);
layered_costmap_->resizeMap((unsigned int)(map_width_meters / resolution),
(unsigned int)(map_height_meters / resolution), resolution, origin_x, origin_y);
}
struct PluginConfig
{
@@ -253,31 +279,8 @@ void Costmap2DROBOT::getParams(const std::string& config_file_name, robot::NodeH
map_update_thread_shutdown_ = false;
double map_update_frequency = loadParam(layer, "update_frequency", 0.0);
// find size parameters
double map_width_meters = loadParam(layer, "width", 0.0);
double map_height_meters = loadParam(layer, "height", 0.0);
double resolution = loadParam(layer, "resolution", 0.0);
double origin_x = loadParam(layer, "origin_x", 0.0);
double origin_y = loadParam(layer, "origin_y", 0.0);
if (nh.hasParam("update_frequency"))
nh.getParam("update_frequency", map_update_frequency);
if (nh.hasParam("width"))
nh.getParam("width", map_width_meters);
if (nh.hasParam("height"))
nh.getParam("height", map_height_meters);
if (nh.hasParam("resolution"))
nh.getParam("resolution", resolution);
if (nh.hasParam("origin_x"))
nh.getParam("origin_x", origin_x);
if (nh.hasParam("origin_y"))
nh.getParam("origin_y", origin_y);
if (!layered_costmap_->isSizeLocked())
{
layered_costmap_->resizeMap((unsigned int)(map_width_meters / resolution),
(unsigned int)(map_height_meters / resolution), resolution, origin_x, origin_y);
}
// If the padding has changed, call setUnpaddedRobotFootprint() to
// re-apply the padding.