|
@@ -25,12 +25,13 @@ bool safety_excutor::init(const shutter::shutter_param& parameter)
|
|
if(parameter.lidars_size()==0)
|
|
if(parameter.lidars_size()==0)
|
|
return false;
|
|
return false;
|
|
mp_lidars=new livox::LivoxMid70[parameter.lidars_size()];
|
|
mp_lidars=new livox::LivoxMid70[parameter.lidars_size()];
|
|
|
|
+ const float DEGREE=M_PI/180.0;
|
|
for(int i=0;i<parameter.lidars_size();++i)
|
|
for(int i=0;i<parameter.lidars_size();++i)
|
|
{
|
|
{
|
|
shutter::lidar_parameter ld_p=parameter.lidars(i);
|
|
shutter::lidar_parameter ld_p=parameter.lidars(i);
|
|
mp_lidars[i].AddBroadcastCode(parameter.lidars(i).sncode());
|
|
mp_lidars[i].AddBroadcastCode(parameter.lidars(i).sncode());
|
|
mp_lidars[i].SetFPS(parameter.lidars(i).fps());
|
|
mp_lidars[i].SetFPS(parameter.lidars(i).fps());
|
|
- mp_lidars[i].SetTransformParam(Eigen::Vector3f(ld_p.r(),ld_p.p(),ld_p.y()),
|
|
|
|
|
|
+ mp_lidars[i].SetTransformParam(Eigen::Vector3f(ld_p.r()*DEGREE,ld_p.p()*DEGREE,ld_p.y()*DEGREE),
|
|
Eigen::Vector3f(ld_p.tx(),ld_p.ty(),ld_p.tz()));
|
|
Eigen::Vector3f(ld_p.tx(),ld_p.ty(),ld_p.tz()));
|
|
}
|
|
}
|
|
m_parameter=parameter;
|
|
m_parameter=parameter;
|
|
@@ -90,8 +91,6 @@ bool safety_excutor::verify(tagMeasureData& data)
|
|
(*cloud)+=(*cloud_t);
|
|
(*cloud)+=(*cloud_t);
|
|
}
|
|
}
|
|
|
|
|
|
-
|
|
|
|
-
|
|
|
|
shutter::box_param box=m_parameter.box();
|
|
shutter::box_param box=m_parameter.box();
|
|
pcl::PointCloud<pcl::PointXYZ>::Ptr cloud_inner=PassThroughCloud(cloud,box);
|
|
pcl::PointCloud<pcl::PointXYZ>::Ptr cloud_inner=PassThroughCloud(cloud,box);
|
|
|
|
|
|
@@ -149,35 +148,37 @@ bool safety_excutor::verify(tagMeasureData& data)
|
|
#if VIEW
|
|
#if VIEW
|
|
|
|
|
|
|
|
|
|
- viewer.removeAllPointClouds();
|
|
|
|
- viewer.removeShape("cube1");
|
|
|
|
- viewer.removeShape("cube2");
|
|
|
|
|
|
+ viewer.removePointCloud(m_parameter.ShortDebugString()+"cloud");
|
|
|
|
+ viewer.removeShape(m_parameter.ShortDebugString()+"cube1");
|
|
|
|
+ viewer.removeShape(m_parameter.ShortDebugString()+"cube2");
|
|
//绘制矩形
|
|
//绘制矩形
|
|
Eigen::AngleAxisf rotation = Eigen::AngleAxisf(0, Eigen::Vector3f::UnitZ());
|
|
Eigen::AngleAxisf rotation = Eigen::AngleAxisf(0, Eigen::Vector3f::UnitZ());
|
|
|
|
|
|
viewer.addCube(Eigen::Vector3f((box1.minx()+box1.maxx())/2.0,(box1.miny()+box1.maxy())/2.0,(box1.minz()+box1.maxz())/2.0),
|
|
viewer.addCube(Eigen::Vector3f((box1.minx()+box1.maxx())/2.0,(box1.miny()+box1.maxy())/2.0,(box1.minz()+box1.maxz())/2.0),
|
|
- Eigen::Quaternionf(rotation), box1.maxx()-box1.minx(), box1.maxy()-box1.miny(),box1.maxz()-box1.minz(),"cube1");
|
|
|
|
|
|
+ Eigen::Quaternionf(rotation), box1.maxx()-box1.minx(), box1.maxy()-box1.miny(),box1.maxz()-box1.minz(),
|
|
|
|
+ m_parameter.ShortDebugString()+"cube1");
|
|
viewer.addCube(Eigen::Vector3f((box2.minx()+box2.maxx())/2.0,(box2.miny()+box2.maxy())/2.0,(box2.minz()+box2.maxz())/2.0),
|
|
viewer.addCube(Eigen::Vector3f((box2.minx()+box2.maxx())/2.0,(box2.miny()+box2.maxy())/2.0,(box2.minz()+box2.maxz())/2.0),
|
|
- Eigen::Quaternionf(rotation), box2.maxx()-box2.minx(), box2.maxy()-box2.miny(),box2.maxz()-box2.minz(),"cube2");
|
|
|
|
- viewer.setShapeRenderingProperties(pcl::visualization::PCL_VISUALIZER_COLOR, 1, 0.5, 0, "cube1");
|
|
|
|
- viewer.setShapeRenderingProperties(pcl::visualization::PCL_VISUALIZER_OPACITY, 0.3, "cube1");
|
|
|
|
|
|
+ Eigen::Quaternionf(rotation), box2.maxx()-box2.minx(), box2.maxy()-box2.miny(),box2.maxz()-box2.minz(),
|
|
|
|
+ m_parameter.ShortDebugString()+"cube2");
|
|
|
|
+ viewer.setShapeRenderingProperties(pcl::visualization::PCL_VISUALIZER_COLOR, 1, 0.5, 0, m_parameter.ShortDebugString()+"cube1");
|
|
|
|
+ viewer.setShapeRenderingProperties(pcl::visualization::PCL_VISUALIZER_OPACITY, 0.3, m_parameter.ShortDebugString()+"cube1");
|
|
|
|
|
|
- viewer.setShapeRenderingProperties(pcl::visualization::PCL_VISUALIZER_COLOR, 0, 0.5, 1, "cube2");
|
|
|
|
- viewer.setShapeRenderingProperties(pcl::visualization::PCL_VISUALIZER_OPACITY, 0.3, "cube2");
|
|
|
|
|
|
+ viewer.setShapeRenderingProperties(pcl::visualization::PCL_VISUALIZER_COLOR, 0, 0.5, 1, m_parameter.ShortDebugString()+"cube2");
|
|
|
|
+ viewer.setShapeRenderingProperties(pcl::visualization::PCL_VISUALIZER_OPACITY, 0.3, m_parameter.ShortDebugString()+"cube2");
|
|
|
|
|
|
|
|
|
|
|
|
|
|
pcl::visualization::PointCloudColorHandlerCustom<pcl::PointXYZ> single_color2(cloud,
|
|
pcl::visualization::PointCloudColorHandlerCustom<pcl::PointXYZ> single_color2(cloud,
|
|
255*int(!data.wheel_path_safety),255*int(data.wheel_path_safety),255*int(!data.parkspcae_safety));
|
|
255*int(!data.wheel_path_safety),255*int(data.wheel_path_safety),255*int(!data.parkspcae_safety));
|
|
- viewer.addPointCloud(cloud, single_color2, "cloud");
|
|
|
|
- viewer.setPointCloudRenderingProperties(pcl::visualization::PCL_VISUALIZER_POINT_SIZE, 1, "cloud");
|
|
|
|
|
|
+ viewer.addPointCloud(cloud, single_color2, m_parameter.ShortDebugString()+"cloud");
|
|
|
|
+ viewer.setPointCloudRenderingProperties(pcl::visualization::PCL_VISUALIZER_POINT_SIZE, 1, m_parameter.ShortDebugString()+"cloud");
|
|
|
|
|
|
viewer.spinOnce();
|
|
viewer.spinOnce();
|
|
#endif
|
|
#endif
|
|
printf(" shutter recieve points %d l_space:%.3f r_space:%.3f wheel_safety: %d parkspace_safety: %d\n",
|
|
printf(" shutter recieve points %d l_space:%.3f r_space:%.3f wheel_safety: %d parkspace_safety: %d\n",
|
|
cloud->size(),data.left_space,data.right_space,data.wheel_path_safety,data.parkspcae_safety);
|
|
cloud->size(),data.left_space,data.right_space,data.wheel_path_safety,data.parkspcae_safety);
|
|
//保存一帧
|
|
//保存一帧
|
|
- static bool saved=false;
|
|
|
|
|
|
+ /*static bool saved=false;
|
|
if(saved==false)
|
|
if(saved==false)
|
|
{
|
|
{
|
|
FILE* p=fopen("./cloud.txt","w");
|
|
FILE* p=fopen("./cloud.txt","w");
|
|
@@ -187,7 +188,7 @@ bool safety_excutor::verify(tagMeasureData& data)
|
|
}
|
|
}
|
|
fclose(p);
|
|
fclose(p);
|
|
saved=true;
|
|
saved=true;
|
|
- }
|
|
|
|
|
|
+ }*/
|
|
|
|
|
|
return data.wheel_path_safety;
|
|
return data.wheel_path_safety;
|
|
|
|
|