update
This commit is contained in:
@@ -1,9 +1,10 @@
|
||||
#include "amr_control/amr_control.h"
|
||||
#include <geometry_msgs/Vector3.h>
|
||||
|
||||
#include <robot/plugin_loader_helper.h>
|
||||
#include <robot/console.h>
|
||||
#include <robot/node_handle.h>
|
||||
#include <tf3/buffer_core.h>
|
||||
#include <geometry_msgs/Vector3.h>
|
||||
|
||||
namespace amr_control
|
||||
{
|
||||
@@ -33,6 +34,7 @@ namespace amr_control
|
||||
loc_base_ptr_(nullptr),
|
||||
move_base_ptr_(nullptr),
|
||||
amr_safety_ptr_(nullptr),
|
||||
tf_converter_ptr_(nullptr),
|
||||
tf_core_ptr_(nullptr),
|
||||
loc_base_loader_("loc_core", "loc_core::BaseLocalization")
|
||||
{
|
||||
@@ -82,8 +84,6 @@ namespace amr_control
|
||||
{
|
||||
nh_ = nh;
|
||||
tf_ = buffer;
|
||||
// Create tf3::BufferCore instance for move_base
|
||||
tf_core_ptr_ = std::make_shared<tf3::BufferCore>();
|
||||
|
||||
monitor_thr_ = std::make_shared<std::thread>(
|
||||
[this]()
|
||||
@@ -225,6 +225,9 @@ namespace amr_control
|
||||
std::string obj_name("move_base::MoveBase");
|
||||
if (tf_ == nullptr)
|
||||
throw std::runtime_error("tf2_ros::Buffer object is null");
|
||||
|
||||
tf_converter_ptr_ = std::make_shared<amr_control::TfConverter>(tf_);
|
||||
tf_converter_ptr_->TfBuffer(tf_core_ptr_);
|
||||
try
|
||||
{
|
||||
robot::log_info("[%s:%d]\n Loading MoveBase library...", __FILE__, __LINE__);
|
||||
@@ -236,8 +239,13 @@ namespace amr_control
|
||||
|
||||
robot::log_info("[%s:%d]\n Creating MoveBase instance...", __FILE__, __LINE__);
|
||||
move_base_ptr_ = move_base_loader_();
|
||||
sensor_converter_ptr_ = std::make_shared<amr_control::SensorConverter>(nh, move_base_ptr_);
|
||||
move_base_ptr_->initialize(tf_core_ptr_);
|
||||
|
||||
|
||||
// Request map từ service hoặc đợi message (vì map server chỉ publish một lần)
|
||||
robot::log_info("[%s:%d]\n Requesting map from server...", __FILE__, __LINE__);
|
||||
sensor_converter_ptr_->requestMapFromServer(nh);
|
||||
|
||||
ros::Rate r(3);
|
||||
do
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user