mirror of
https://github.com/introlab/rtabmap_ros.git
synced 2026-10-11 12:09:51 +08:00
CoreWrapper: 2d optimized map should not be loaded in SLAM mode (see also https://github.com/introlab/rtabmap/commit/f6e17be2b4196d588305fe20e080406a4841983a).
This commit is contained in:
+29
-10
@@ -623,20 +623,39 @@ void CoreWrapper::onInit()
|
|||||||
// Init RTAB-Map
|
// Init RTAB-Map
|
||||||
rtabmap_.init(parameters_, databasePath_);
|
rtabmap_.init(parameters_, databasePath_);
|
||||||
|
|
||||||
if(rtabmap_.getMemory() && useSavedMap_)
|
if(rtabmap_.getMemory())
|
||||||
{
|
{
|
||||||
float xMin, yMin, gridCellSize;
|
if(useSavedMap_ && !rtabmap_.getMemory()->isIncremental())
|
||||||
cv::Mat map = rtabmap_.getMemory()->load2DMap(xMin, yMin, gridCellSize);
|
|
||||||
if(!map.empty())
|
|
||||||
{
|
{
|
||||||
NODELET_INFO("rtabmap: 2D occupancy grid map loaded (%dx%d).", map.cols, map.rows);
|
float xMin, yMin, gridCellSize;
|
||||||
mapsManager_.set2DMap(map, xMin, yMin, gridCellSize, rtabmap_.getLocalOptimizedPoses(), rtabmap_.getMemory());
|
cv::Mat map = rtabmap_.getMemory()->load2DMap(xMin, yMin, gridCellSize);
|
||||||
|
if(!map.empty())
|
||||||
|
{
|
||||||
|
NODELET_INFO("rtabmap: 2D occupancy grid map loaded (%dx%d).", map.cols, map.rows);
|
||||||
|
mapsManager_.set2DMap(map, xMin, yMin, gridCellSize, rtabmap_.getLocalOptimizedPoses(), rtabmap_.getMemory());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
if(databasePath_.size() && rtabmap_.getMemory())
|
if(rtabmap_.getMemory()->getWorkingMem().size()>1)
|
||||||
{
|
{
|
||||||
NODELET_INFO("rtabmap: Database version = \"%s\".", rtabmap_.getMemory()->getDatabaseVersion().c_str());
|
NODELET_INFO("rtabmap: Working Memory = %d, Local map = %d.",
|
||||||
|
(int)rtabmap_.getMemory()->getWorkingMem().size()-1,
|
||||||
|
(int)rtabmap_.getLocalOptimizedPoses().size());
|
||||||
|
}
|
||||||
|
|
||||||
|
if(databasePath_.size())
|
||||||
|
{
|
||||||
|
NODELET_INFO("rtabmap: Database version = \"%s\".", rtabmap_.getMemory()->getDatabaseVersion().c_str());
|
||||||
|
}
|
||||||
|
|
||||||
|
if(rtabmap_.getMemory()->isIncremental())
|
||||||
|
{
|
||||||
|
NODELET_INFO("rtabmap: SLAM mode (%s=true)", Parameters::kMemIncrementalMemory().c_str());
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
NODELET_INFO("rtabmap: Localization mode (%s=false)", Parameters::kMemIncrementalMemory().c_str());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// setup services
|
// setup services
|
||||||
|
|||||||
@@ -162,6 +162,7 @@ public:
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ROS_INFO("%s: regenerate_local_grids = %s", ros::this_node::getName().c_str(), localGridsRegenerated_?"true":"false");
|
||||||
mapsManager_.init(nh, pnh, ros::this_node::getName(), false);
|
mapsManager_.init(nh, pnh, ros::this_node::getName(), false);
|
||||||
mapsManager_.backwardCompatibilityParameters(pnh, parameters);
|
mapsManager_.backwardCompatibilityParameters(pnh, parameters);
|
||||||
mapsManager_.setParameters(parameters);
|
mapsManager_.setParameters(parameters);
|
||||||
|
|||||||
@@ -70,7 +70,8 @@ public:
|
|||||||
exactSync3_(0),
|
exactSync3_(0),
|
||||||
approxSync3_(0),
|
approxSync3_(0),
|
||||||
exactSync2_(0),
|
exactSync2_(0),
|
||||||
approxSync2_(0)
|
approxSync2_(0),
|
||||||
|
waitForTransformDuration_(0.1)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
virtual ~PointCloudAggregator()
|
virtual ~PointCloudAggregator()
|
||||||
@@ -104,6 +105,7 @@ private:
|
|||||||
pnh.param("fixed_frame_id", fixedFrameId_, fixedFrameId_);
|
pnh.param("fixed_frame_id", fixedFrameId_, fixedFrameId_);
|
||||||
pnh.param("approx_sync", approx, approx);
|
pnh.param("approx_sync", approx, approx);
|
||||||
pnh.param("count", count, count);
|
pnh.param("count", count, count);
|
||||||
|
pnh.param("wait_for_transform_duration", waitForTransformDuration_, waitForTransformDuration_);
|
||||||
|
|
||||||
cloudSub_1_.subscribe(nh, "cloud1", 1);
|
cloudSub_1_.subscribe(nh, "cloud1", 1);
|
||||||
cloudSub_2_.subscribe(nh, "cloud2", 1);
|
cloudSub_2_.subscribe(nh, "cloud2", 1);
|
||||||
@@ -233,7 +235,6 @@ private:
|
|||||||
for(unsigned int i=1; i<cloudMsgs.size(); ++i)
|
for(unsigned int i=1; i<cloudMsgs.size(); ++i)
|
||||||
{
|
{
|
||||||
rtabmap::Transform cloudDisplacement;
|
rtabmap::Transform cloudDisplacement;
|
||||||
bool notsync = false;
|
|
||||||
if(!fixedFrameId_.empty() &&
|
if(!fixedFrameId_.empty() &&
|
||||||
cloudMsgs[0]->header.stamp != cloudMsgs[i]->header.stamp)
|
cloudMsgs[0]->header.stamp != cloudMsgs[i]->header.stamp)
|
||||||
{
|
{
|
||||||
@@ -244,8 +245,7 @@ private:
|
|||||||
cloudMsgs[i]->header.stamp, //stampSource
|
cloudMsgs[i]->header.stamp, //stampSource
|
||||||
cloudMsgs[0]->header.stamp, //stampTarget
|
cloudMsgs[0]->header.stamp, //stampTarget
|
||||||
tfListener_,
|
tfListener_,
|
||||||
0.1);
|
waitForTransformDuration_);
|
||||||
notsync = true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
pcl::PCLPointCloud2 cloud2;
|
pcl::PCLPointCloud2 cloud2;
|
||||||
@@ -335,6 +335,7 @@ private:
|
|||||||
|
|
||||||
std::string frameId_;
|
std::string frameId_;
|
||||||
std::string fixedFrameId_;
|
std::string fixedFrameId_;
|
||||||
|
double waitForTransformDuration_;
|
||||||
tf::TransformListener tfListener_;
|
tf::TransformListener tfListener_;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user