|
@@ -19,6 +19,8 @@ using google::protobuf::io::CodedInputStream;
|
|
|
using google::protobuf::io::ZeroCopyOutputStream;
|
|
|
using google::protobuf::io::CodedOutputStream;
|
|
|
using google::protobuf::Message;
|
|
|
+#include "setting.pb.h"
|
|
|
+#include "safety_excutor.h"
|
|
|
GOOGLE_GLOG_DLL_DECL void shut_down_logging(const char* data, int size)
|
|
|
{
|
|
|
time_t tt;
|
|
@@ -79,8 +81,21 @@ void init_glog()
|
|
|
std::mutex mut;
|
|
|
pcl::visualization::PCLVisualizer viewer("Cloud");
|
|
|
|
|
|
-livox::LivoxMid70 read_lidar;
|
|
|
-livox::LivoxMid70 read_lidar1;
|
|
|
+
|
|
|
+
|
|
|
+//读取protobuf 配置文件
|
|
|
+//file:文件
|
|
|
+//parameter:要读取的配置
|
|
|
+bool read_proto_param(std::string file, ::google::protobuf::Message& parameter)
|
|
|
+{
|
|
|
+ int fd = open(file.c_str(), O_RDONLY);
|
|
|
+ if (fd == -1) return false;
|
|
|
+ FileInputStream* input = new FileInputStream(fd);
|
|
|
+ bool success = google::protobuf::TextFormat::Parse(input, ¶meter);
|
|
|
+ delete input;
|
|
|
+ close(fd);
|
|
|
+ return success;
|
|
|
+}
|
|
|
|
|
|
int Working()
|
|
|
{
|
|
@@ -269,10 +284,26 @@ int main(int argc,char* argv[])
|
|
|
init_glog();
|
|
|
viewer.addCoordinateSystem(2.0,0,0,0,"car_center");
|
|
|
|
|
|
-
|
|
|
int ret = livox::LdsLidar::InitLdsLidar();
|
|
|
|
|
|
- const float DEGREE=M_PI/180.0;
|
|
|
+
|
|
|
+ shutter::shutter_param shutter_param;
|
|
|
+ if(read_proto_param("./setting/setting.prototxt",shutter_param)==false)
|
|
|
+ {
|
|
|
+ printf(" read proto failed \n");
|
|
|
+ return -1;
|
|
|
+ }
|
|
|
+
|
|
|
+ safety_excutor* excutor=safety_excutor::CreateExcutor(shutter_param);
|
|
|
+ if(excutor== nullptr)
|
|
|
+ {
|
|
|
+ printf(" create safety_excutor failed\n");
|
|
|
+ return -1;
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ /*const float DEGREE=M_PI/180.0;
|
|
|
float transform1[]={-2.31,161.58,-64,2.512,0,0};
|
|
|
float transform2[]={176.45,28.05,71.85,0,0,0};
|
|
|
|
|
@@ -285,9 +316,9 @@ int main(int argc,char* argv[])
|
|
|
rpy2<<176.45*DEGREE,28.05*DEGREE,71.85*DEGREE;
|
|
|
|
|
|
Eigen::Vector3f t1;
|
|
|
- t1<<2.512,0,0;
|
|
|
+ t1<<1.256,0,0;
|
|
|
Eigen::Vector3f t2;
|
|
|
- t2<<0,0,0;
|
|
|
+ t2<<-1.256,0,0;
|
|
|
|
|
|
|
|
|
read_lidar.SetTransformParam(rpy1,t1);
|
|
@@ -300,8 +331,8 @@ int main(int argc,char* argv[])
|
|
|
printf("%s connect failed\n",sn2.c_str());
|
|
|
|
|
|
}
|
|
|
- read_lidar.SetFPS(2.0);
|
|
|
- read_lidar1.SetFPS(2.0);
|
|
|
+ read_lidar.SetFPS(10.0);
|
|
|
+ read_lidar1.SetFPS(10.0);*/
|
|
|
usleep(3000*1000);
|
|
|
|
|
|
|
|
@@ -314,23 +345,8 @@ int main(int argc,char* argv[])
|
|
|
|
|
|
while(1)
|
|
|
{
|
|
|
-
|
|
|
- pcl::PointCloud<pcl::PointXYZ>::Ptr cloud1=read_lidar.GetCloud();
|
|
|
- pcl::PointCloud<pcl::PointXYZ>::Ptr cloud2=read_lidar1.GetCloud();
|
|
|
- viewer.removeAllPointClouds();
|
|
|
- int color[3]={0,255,0};
|
|
|
- pcl::visualization::PointCloudColorHandlerCustom<pcl::PointXYZ> single_color(cloud1, color[0],color[1],color[2]); // green
|
|
|
- viewer.addPointCloud(cloud1, single_color, "cloud1");
|
|
|
- viewer.setPointCloudRenderingProperties(pcl::visualization::PCL_VISUALIZER_POINT_SIZE, 1, "cloud1");
|
|
|
-
|
|
|
-
|
|
|
- pcl::visualization::PointCloudColorHandlerCustom<pcl::PointXYZ> single_color2(cloud2, 255,0,0); // green
|
|
|
- viewer.addPointCloud(cloud2, single_color2, "cloud2");
|
|
|
- viewer.setPointCloudRenderingProperties(pcl::visualization::PCL_VISUALIZER_POINT_SIZE, 1, "cloud2");
|
|
|
-
|
|
|
- printf(" lidar 1 count %d lidar2 count %d \n",cloud1->size(),cloud2->size());
|
|
|
-
|
|
|
- viewer.spinOnce();
|
|
|
+ excutor->verify();
|
|
|
+ /**/
|
|
|
usleep(33*1000);
|
|
|
}
|
|
|
|