我想要一个在云点上包含可视化器的类.这是我的代码:
class my_vis
{
void vis_func ()
{
pcl::visualization::PCLVisualizer *vis ;
vis = new pcl::visualization::PCLVisualizer("octree viewer");
// this "vis" is just used in this function and no other place
}
void execute(){
//Start visualizer in a thread
boost::thread* visThread = new boost::thread(boost::bind(&my_vis::vis_func, this));
// bla bla
}
}
int main ()
{
my_vis vis1();
vis1.execute();
my_vis vis2();
vis2.execute();
std::getchar();
return 0 ;
}
Run Code Online (Sandbox Code Playgroud)
现在我有一类可视化器,可以在"main"中实例化.当我从类"my_vis"中只创建一个实例时,程序运行时每件事都可以.但我需要两个或更多实例.当我初始化多个实例时,发生了错误:BLOCK_TYPE_IS_VALID我认为这是因为使用了线程.但是在我的项目中需要线程化.
你能帮帮我吗?非常感谢您的耐心和帮助:)
PS我正在使用PCL 1.7