Selaa lähdekoodia

230117 yct for measure cloud saving

yct 1 vuosi sitten
vanhempi
commit
d8da334d67

+ 28 - 11
测量节点/system/system_communication mq.cpp

@@ -2,7 +2,7 @@
  * @Author: yct 18202736439@163.com
  * @Date: 2022-09-30 18:11:59
  * @LastEditors: yct 18202736439@163.com
- * @LastEditTime: 2022-09-30 18:41:52
+ * @LastEditTime: 2023-01-17 15:41:04
  * @FilePath: /puai_wj_2021/system/system_communication mq.cpp
  * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
  */
@@ -98,16 +98,33 @@ Error_manager System_communication_mq::execute_dispatch_status_msg(Rabbitmq_mess
 		{
 			std::string t_string = t_park_table_msg.DebugString();
 			LOG(INFO) << " huli test::t_string = t_park_table_msg "<< t_string << " --- " ;
-			//给唐有成, 这里面有terminal_id(范围1-6), 可以触发感测节点保存事件.
-			//..............................
-
-
-
-
-
-
-		}
-		//指令信息必须手动ack, 这样才能清除服务器的指令,
+            // 给唐有成, 这里面有terminal_id(范围1-6), 可以触发感测节点保存事件.
+            
+            //  added by yct for region cloud saving function
+            //  vlp16 region
+            std::map<int, Ground_region *> t_ground_region_map = Velodyne_manager::get_instance_references().get_ground_region_map();
+            int region_index = 0;
+            for (auto iter = t_ground_region_map.begin(); iter != t_ground_region_map.end(); ++iter)
+            {
+                // get clouds from corresponding region
+                if(t_park_table_msg.terminal_id()-1 == iter->second->get_terminal_id())
+                {
+                    pcl::PointCloud<pcl::PointXYZ>::Ptr t_total_cloud = pcl::PointCloud<pcl::PointXYZ>::Ptr(new pcl::PointCloud<pcl::PointXYZ>);
+                    pcl::PointCloud<pcl::PointXYZ>::Ptr t_filtered_cloud = pcl::PointCloud<pcl::PointXYZ>::Ptr(new pcl::PointCloud<pcl::PointXYZ>);
+                    iter->second->get_region_cloud(t_total_cloud, Ground_region::Region_cloud_type::total);
+                    iter->second->get_region_cloud(t_filtered_cloud, Ground_region::Region_cloud_type::filtered);
+                    PathCreator pc;
+                    pc.Mkdir("./data/");
+                    if(pc.CreateDatePath(pc.GetCurPath(), true))
+                    {
+                        save_cloud_txt(t_total_cloud, pc.GetCurPath()+"total.txt");
+                        save_cloud_txt(t_total_cloud, pc.GetCurPath()+"filtered.txt");
+                        LOG(INFO) <<"total and filtered cloud in region "<<t_park_table_msg.terminal_id()<<"(1-6) has been saved in "<<pc.GetCurPath();
+                    }
+                }
+            }
+        }
+        //指令信息必须手动ack, 这样才能清除服务器的指令,
 		//(状态消息临时队列接受后自动清除, 指令消息永久队列接收后手动清除)
 		ack_msg(p_msg);
 	}

+ 2 - 0
测量节点/system/system_executor.cpp

@@ -22,6 +22,8 @@ Error_manager System_executor::system_executor_init(int threads_size, int termin
 	m_thread_pool.thread_pool_init(threads_size);
 	m_system_executor_status = SYSTEM_EXECUTOR_READY;
 	m_terminal_id = terminal_id;
+	PathCreator pc;
+	pc.Mkdir("./log/");
 	return Error_code::SUCCESS;
 }
 

+ 1 - 0
测量节点/system/system_executor.h

@@ -7,6 +7,7 @@
 
 #include "../tool/thread_pool.h"
 #include "../tool/singleton.h"
+#include "../tool/pathcreator.h"
 #include "../error_code/error_code.h"
 #include "../communication/communication_message.h"