问题遇到的现象和发生背景
这段程序主要是用来测试使用gtsam,当初始化isam2指针时,出现错误,错误地点为
isam =new ISAM2(parameters);
//
// Created by on 22-4-17.
//
#include "ros/ros.h"
#include "pcl/registration/ndt.h"
#include "lio_2d_sam/cloud_info.h"
#include <gtsam/geometry/Rot2.h>
#include <gtsam/geometry/Pose2.h>
#include <gtsam/slam/PriorFactor.h>
#include <gtsam/slam/BetweenFactor.h>
#include <gtsam/navigation/GPSFactor.h>
#include <gtsam/navigation/ImuFactor.h>
#include <gtsam/navigation/CombinedImuFactor.h>
#include <gtsam/nonlinear/NonlinearFactorGraph.h>
#include <gtsam/nonlinear/LevenbergMarquardtOptimizer.h>
#include <gtsam/nonlinear/Marginals.h>
#include <gtsam/nonlinear/Values.h>
#include <gtsam/inference/Symbol.h>
#include <gtsam/nonlinear/ISAM2.h>
#include <gtsam/inference/Symbol.h>
using namespace gtsam;
using symbol_shorthand::X; // Pose3 (x,y,z,r,p,y)
using symbol_shorthand::V; // Vel (xdot,ydot,zdot)
using symbol_shorthand::B; // Bias (ax,ay,az,gx,gy,gz)
class map_optimaization{
private:
ros::NodeHandle nh;
NonlinearFactorGraph gtSAMgraph;//非线性因子图
Values initialEstimate;//初始估计
Values optimizedEstimate;//优化后的估计
ISAM2 *isam;//初始化isam
Values isamCurrentEstimate;//isam当前估计
Eigen::MatrixXd poseCovariance;//定义位姿协方差矩阵
ros::Subscriber sub_msg_info;
ISAM2Params parameters;
public:
map_optimaization(){
//订阅info
sub_msg_info =nh.subscribe<sensor_msgs::LaserScan>("/scan", 1, &map_optimaization::tesla,this);
parameters.relinearizeThreshold = 0.1;
parameters.relinearizeSkip = 1;
isam =new ISAM2(parameters);
}
~map_optimaization(){};
void tesla(const sensor_msgs::LaserScanConstPtr& msg_info_in){
std::cout<<"0000"<<std::endl;
std::cout<<"yyyy"<<std::endl;
}
};
int main(int argc, char** argv)
{
ros::init(argc, argv, "lio_2d_sam");
map_optimaization MO;
ROS_INFO("\033[1;32m----> Map Optimization Started.\033[0m");
ros::spin();
return 0;
}
运行结果及报错内容
[ INFO] [1650853307.694610562]: ----> Map Optimization Started.
lio_2d_sam_multiecholaser2laser: malloc.c:2401: sysmalloc: Assertion `(old_top == initial_top (av) && old_size == 0) || ((unsigned long) (old_size) >= MINSIZE && prev_inuse (old_top) && ((unsigned long) old_end & (pagesize - 1)) == 0)' failed.
Signal: SIGABRT (Aborted)
我的解答思路和尝试过的方法
我想要达到的结果
请问,这是哪个环节出了问题,怎样解决这一问题!