main.cpp 31 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662
  1. //
  2. // huli test 20200223
  3. //
  4. #include <iostream>
  5. #include "./error_code/error_code.h"
  6. //#include "LogFiles.h"
  7. #include <glog/logging.h>
  8. #include "./communication/communication_socket_base.h"
  9. #include "./tool/thread_pool.h"
  10. #include "./system/system_communication.h"
  11. #include "./system/system_executor.h"
  12. #include "./dispatch/dispatch_manager.h"
  13. #include "./dispatch/dispatch_communication.h"
  14. #include "./dispatch/dispatch_coordinates.h"
  15. #include "./tool/common_data.h"
  16. #include <algorithm> // std::for_each
  17. #define LIVOX_NUMBER 2
  18. GOOGLE_GLOG_DLL_DECL void shut_down_logging(const char* data, int size)
  19. {
  20. time_t tt;
  21. time( &tt );
  22. tt = tt + 8*3600; // transform the time zone
  23. tm* t= gmtime( &tt );
  24. char buf[255]={0};
  25. sprintf(buf,"./%d%02d%02d-%02d%02d%02d-dump.txt",
  26. t->tm_year + 1900,
  27. t->tm_mon + 1,
  28. t->tm_mday,
  29. t->tm_hour,
  30. t->tm_min,
  31. t->tm_sec);
  32. FILE* tp_file=fopen(buf,"w");
  33. fprintf(tp_file,data,strlen(data));
  34. fclose(tp_file);
  35. }
  36. #include <chrono>
  37. using namespace std;
  38. #define MAIN_TEST 1
  39. int main(int argc,char* argv[])
  40. {
  41. Error_manager t_error;
  42. const char* logPath = "./";
  43. google::InitGoogleLogging("LidarMeasurement");
  44. google::SetStderrLogging(google::INFO);
  45. google::SetLogDestination(0, logPath);
  46. google::SetLogFilenameExtension("zxlog");
  47. google::InstallFailureSignalHandler();
  48. google::InstallFailureWriter(&shut_down_logging);
  49. FLAGS_colorlogtostderr = true; // Set log color
  50. FLAGS_logbufsecs = 0; // Set log output speed(s)
  51. FLAGS_max_log_size = 1024; // Set max log file size(GB)
  52. FLAGS_stop_logging_if_full_disk = true;
  53. #ifdef MAIN_TEST
  54. t_error = Dispatch_coordinates::get_instance_references().dispatch_coordinates_init();
  55. std::cout << " huli test :::: " << " t_error.to = " << t_error.to_string() << std::endl;
  56. t_error = Dispatch_communication::get_instance_references().communication_init();
  57. std::cout << " huli test :::: " << " t_error.to = " << t_error.to_string() << std::endl;
  58. std::cout << "Dispatch_communication = " << Dispatch_communication::get_instance_references().get_status() << std::endl;
  59. t_error = Dispatch_manager::get_instance_references().dispatch_manager_init(0);
  60. std::cout << " huli test :::: " << " t_error.to = " << t_error.to_string() << std::endl;
  61. std::cout << "Dispatch_manager = " << Dispatch_manager::get_instance_references().get_dispatch_manager_status() << std::endl;
  62. System_executor::get_instance_references().system_executor_init(10);
  63. std::cout << "System_executor = " << System_executor::get_instance_references().get_system_executor_status() << std::endl;
  64. System_communication::get_instance_references().communication_init();
  65. System_communication::get_instance_references().set_encapsulate_cycle_time(1000);
  66. while (1)
  67. {
  68. }
  69. return 0;
  70. #endif
  71. // Error_manager t_error;
  72. t_error = Dispatch_communication::get_instance_references().communication_init();
  73. std::cout << " huli test :::: " << " t_error = " << t_error << std::endl;
  74. std::cout << "Dispatch_communication = " << Dispatch_communication::get_instance_references().get_status() << std::endl;
  75. std::this_thread::sleep_for(std::chrono::seconds(2));
  76. std::cout << " huli test :::: " << " t_error = " << t_error << std::endl;
  77. std::cout << "Dispatch_communication = " << Dispatch_communication::get_instance_references().get_status() << std::endl;
  78. std::cout << " ---------------------------------------------------" << std::endl;
  79. std::cout << " ---------------------------------------------------" << std::endl;
  80. Catcher t_catcher;
  81. t_error = t_catcher.dispatch_device_base_init(1);
  82. std::cout << " huli test :::: " << " t_error = " << t_error << std::endl;
  83. std::this_thread::sleep_for(std::chrono::seconds(2));
  84. std::shared_ptr<Task_Base> tp_task_Base1(new Catcher_task);
  85. Catcher_task * tp_catcher_task1 = (Catcher_task *)tp_task_Base1.get();
  86. tp_catcher_task1->task_init(NULL,std::chrono::milliseconds(15000));
  87. tp_catcher_task1->m_request_key = "x23456789012345678901234567890r1";
  88. tp_catcher_task1->m_request_x = 11055;
  89. tp_catcher_task1->m_request_y = 3000;
  90. tp_catcher_task1->m_request_b = 90;
  91. tp_catcher_task1->m_request_z = 5410;
  92. tp_catcher_task1->m_request_d1 = 355;
  93. tp_catcher_task1->m_request_d2 = 455;
  94. tp_catcher_task1->m_request_wheelbase = 2800;
  95. tp_catcher_task1->m_request_clamp_motion = Catcher_task::E_CLAMP_LOOSE;
  96. t_error = t_catcher.execute_task(tp_task_Base1, Dispatch_device_base::DISPATCH_TASK_ONE_LEVEL);
  97. std::cout << " huli test :::: " << " t_error = " << t_error << std::endl;
  98. std::cout << " ---------------------------------------------------" << std::endl;
  99. /*
  100. char zxczxcxzc1 ;
  101. std::cin >> zxczxcxzc1 ;
  102. while ( 1 )
  103. {
  104. std::cout << " huli test :::: " << " ===================================== " << std::endl;
  105. std::cout << " huli test :::: " << " tp_catcher_task->get_task_statu = " << tp_catcher_task->get_task_statu() << std::endl;
  106. std::cout << " huli test :::: " << " tp_catcher_task->m_respons_status = " << tp_catcher_task->m_respons_status << std::endl;
  107. std::cout << " huli test :::: " << " m_respons_key = " << tp_catcher_task->m_respons_key << std::endl;
  108. std::cout << " huli test :::: " << " m_respons_status = " << tp_catcher_task->m_respons_status << std::endl;
  109. std::cout << " huli test :::: " << " m_respons_x = " << tp_catcher_task->m_respons_x << std::endl;
  110. std::cout << " huli test :::: " << " m_respons_y = " << tp_catcher_task->m_respons_y << std::endl;
  111. std::cout << " huli test :::: " << " m_respons_b = " << tp_catcher_task->m_respons_b << std::endl;
  112. std::cout << " huli test :::: " << " m_respons_z = " << tp_catcher_task->m_respons_z << std::endl;
  113. std::cout << " huli test :::: " << " m_respons_d1 = " << tp_catcher_task->m_respons_d1 << std::endl;
  114. std::cout << " huli test :::: " << " m_respons_d2 = " << tp_catcher_task->m_respons_d2 << std::endl;
  115. std::cout << " huli test :::: " << " m_respons_wheelbase = " << tp_catcher_task->m_respons_wheelbase << std::endl;
  116. std::cout << " huli test :::: " << " m_respons_clamp_motion = " << tp_catcher_task->m_respons_clamp_motion << std::endl;
  117. std::cout << " ---------------------------------------------------" << std::endl;
  118. std::cout << " huli test :::: " << " *********************************************** = " << std::endl;
  119. std::cout << " huli test :::: " << " t_carrier_base.get_carrier_status() = " << t_catcher.get_dispatch_device_status() << std::endl;
  120. int heat = t_catcher.m_last_heartbeat;
  121. std::cout << " huli test :::: " << " m_last_heartbeat = " << heat << std::endl;
  122. std::cout << " huli test :::: " << " m_actual_device_status = " << t_catcher.m_actual_device_status << std::endl;
  123. std::cout << " huli test :::: " << " m_actual_load_status = " << t_catcher.m_actual_load_status << std::endl;
  124. std::cout << " huli test :::: " << " m_actual_x = " << t_catcher.m_actual_x << std::endl;
  125. std::cout << " huli test :::: " << " m_actual_y = " << t_catcher.m_actual_y << std::endl;
  126. std::cout << " huli test :::: " << " m_actual_b = " << t_catcher.m_actual_b << std::endl;
  127. std::cout << " huli test :::: " << " m_actual_z = " << t_catcher.m_actual_z << std::endl;
  128. std::cout << " huli test :::: " << " m_actual_d1 = " << t_catcher.m_actual_d1 << std::endl;
  129. std::cout << " huli test :::: " << " m_actual_d2 = " << t_catcher.m_actual_d2 << std::endl;
  130. std::cout << " huli test :::: " << " m_actual_clamp_motion1 = " << t_catcher.m_actual_clamp_motion1 << std::endl;
  131. std::cout << " huli test :::: " << " m_actual_clamp_motion2 = " << t_catcher.m_actual_clamp_motion2 << std::endl;
  132. std::cout << " huli test :::: " << " m_actual_clamp_motion3 = " << t_catcher.m_actual_clamp_motion3 << std::endl;
  133. std::cout << " huli test :::: " << " m_actual_clamp_motion4 = " << t_catcher.m_actual_clamp_motion4 << std::endl;
  134. std::cout << " huli test :::: " << " m_actual_error_code = " << std::endl;
  135. for (int i = 0; i < 50; ++i)
  136. {
  137. printf("0x%x ", t_catcher.m_actual_error_code[i]);
  138. }
  139. std::cout << std::endl;
  140. std::cout << " huli test :::: " << " m_actual_warning_code = " << std::endl;
  141. for (int i = 0; i < 50; ++i)
  142. {
  143. printf("0x%x ", t_catcher.m_actual_warning_code[i]);
  144. }
  145. std::cout << std::endl;
  146. std::cout << " huli test :::: " << " m_actual_error_description = " << t_catcher.m_actual_error_description << std::endl;
  147. std::cout << " huli test :::: " << " *********************************************** = " << std::endl;
  148. std::this_thread::sleep_for(std::chrono::milliseconds(1000));
  149. }
  150. */
  151. Carrier t_carrier20;
  152. t_error = t_carrier20.dispatch_device_base_init(0);
  153. std::cout << " huli test :::: " << " t_error = " << t_error << std::endl;
  154. std::this_thread::sleep_for(std::chrono::seconds(2));
  155. std::shared_ptr<Task_Base> tp_task_Base20(new Carrier_task);
  156. Carrier_task * tp_carrier_task20 = (Carrier_task *)tp_task_Base20.get();
  157. tp_carrier_task20->task_init(NULL,std::chrono::milliseconds(15000));
  158. tp_carrier_task20->m_request_key = "x23456789012345678901234567890c0";
  159. tp_carrier_task20->m_request_x = 1;
  160. // tp_carrier_task20->m_request_x = 32600;
  161. tp_carrier_task20->m_request_y = 3000;
  162. tp_carrier_task20->m_request_z = 2525;
  163. tp_carrier_task20->m_request_y1 = 4500;
  164. tp_carrier_task20->m_request_y2 = 1700;
  165. tp_carrier_task20->m_request_clamp_motion = Carrier_task::E_CLAMP_LOOSE;
  166. tp_carrier_task20->m_request_joint_motion_x = Carrier_task::E_JOINT_HOLD_OUT;
  167. tp_carrier_task20->m_request_joint_motion_y = Carrier_task::E_JOINT_HOLD_OUT;
  168. tp_carrier_task20->m_request_space_id = 555;
  169. tp_carrier_task20->m_request_floor_id = 555;
  170. tp_carrier_task20->m_request_wheelbase = 555;
  171. t_error = t_carrier20.execute_task(tp_task_Base20, Dispatch_device_base::DISPATCH_TASK_ONE_LEVEL);
  172. std::cout << " huli test :::: " << " t_error = " << t_error << std::endl;
  173. std::cout << " ---------------------------------------------------" << std::endl;
  174. /*
  175. char zxczxcxzc20 ;
  176. std::cin >> zxczxcxzc20 ;
  177. while ( 1 )
  178. {
  179. std::cout << " huli test :::: " << " ===================================== " << std::endl;
  180. std::cout << " huli test :::: " << " tp_carrier_task->get_task_statu = " << tp_carrier_task->get_task_statu() << std::endl;
  181. std::cout << " huli test :::: " << " tp_carrier_task->m_respons_status = " << tp_carrier_task->m_respons_status << std::endl;
  182. std::cout << " huli test :::: " << " m_respons_key = " << tp_carrier_task->m_respons_key << std::endl;
  183. std::cout << " huli test :::: " << " m_respons_status = " << tp_carrier_task->m_respons_status << std::endl;
  184. std::cout << " huli test :::: " << " m_respons_x = " << tp_carrier_task->m_respons_x << std::endl;
  185. std::cout << " huli test :::: " << " m_respons_y = " << tp_carrier_task->m_respons_y << std::endl;
  186. std::cout << " huli test :::: " << " m_respons_z = " << tp_carrier_task->m_respons_z << std::endl;
  187. std::cout << " huli test :::: " << " m_respons_y1 = " << tp_carrier_task->m_respons_y1 << std::endl;
  188. std::cout << " huli test :::: " << " m_respons_y2 = " << tp_carrier_task->m_respons_y2 << std::endl;
  189. std::cout << " huli test :::: " << " m_respons_clamp_motion = " << tp_carrier_task->m_respons_clamp_motion << std::endl;
  190. std::cout << " huli test :::: " << " m_respons_joint_motion_x = " << tp_carrier_task->m_respons_joint_motion_x << std::endl;
  191. std::cout << " huli test :::: " << " m_respons_joint_motion_y = " << tp_carrier_task->m_respons_joint_motion_y << std::endl;
  192. std::cout << " huli test :::: " << " m_respons_space_id = " << tp_carrier_task->m_respons_space_id << std::endl;
  193. std::cout << " huli test :::: " << " m_respons_floor_id = " << tp_carrier_task->m_respons_floor_id << std::endl;
  194. std::cout << " huli test :::: " << " m_respons_wheelbase = " << tp_carrier_task->m_respons_wheelbase << std::endl;
  195. std::cout << " ---------------------------------------------------" << std::endl;
  196. std::cout << " huli test :::: " << " *********************************************** = " << std::endl;
  197. std::cout << " huli test :::: " << " t_carrier_base.get_carrier_status() = " << t_carrier.get_dispatch_device_status() << std::endl;
  198. int heat = t_carrier.m_last_heartbeat;
  199. std::cout << " huli test :::: " << " m_last_heartbeat = " << heat << std::endl;
  200. std::cout << " huli test :::: " << " m_actual_device_status = " << t_carrier.m_actual_device_status << std::endl;
  201. std::cout << " huli test :::: " << " m_actual_load_status = " << t_carrier.m_actual_load_status << std::endl;
  202. std::cout << " huli test :::: " << " m_actual_x = " << t_carrier.m_actual_x << std::endl;
  203. std::cout << " huli test :::: " << " m_actual_y = " << t_carrier.m_actual_y << std::endl;
  204. std::cout << " huli test :::: " << " m_actual_z = " << t_carrier.m_actual_z << std::endl;
  205. std::cout << " huli test :::: " << " m_actual_y1 = " << t_carrier.m_actual_y1 << std::endl;
  206. std::cout << " huli test :::: " << " m_actual_y2 = " << t_carrier.m_actual_y2 << std::endl;
  207. std::cout << " huli test :::: " << " m_actual_clamp_motion1 = " << t_carrier.m_actual_clamp_motion1 << std::endl;
  208. std::cout << " huli test :::: " << " m_actual_clamp_motion2 = " << t_carrier.m_actual_clamp_motion2 << std::endl;
  209. std::cout << " huli test :::: " << " m_actual_small_sports_car_motion = " << t_carrier.m_actual_small_sports_car_motion << std::endl;
  210. std::cout << " huli test :::: " << " m_actual_joint_motion_x1 = " << t_carrier.m_actual_joint_motion_x1 << std::endl;
  211. std::cout << " huli test :::: " << " m_actual_joint_motion_x2 = " << t_carrier.m_actual_joint_motion_x2 << std::endl;
  212. std::cout << " huli test :::: " << " m_actual_error_code = " << std::endl;
  213. for (int i = 0; i < 50; ++i)
  214. {
  215. printf("0x%x ", t_carrier.m_actual_error_code[i]);
  216. }
  217. std::cout << std::endl;
  218. std::cout << " huli test :::: " << " m_actual_warning_code = " << std::endl;
  219. for (int i = 0; i < 50; ++i)
  220. {
  221. printf("0x%x ", t_carrier.m_actual_warning_code[i]);
  222. }
  223. std::cout << std::endl;
  224. std::cout << " huli test :::: " << " m_actual_error_description = " << t_carrier.m_actual_error_description << std::endl;
  225. std::cout << " huli test :::: " << " *********************************************** = " << std::endl;
  226. std::this_thread::sleep_for(std::chrono::milliseconds(1000));
  227. }
  228. */
  229. Carrier t_carrier21;
  230. t_error = t_carrier21.dispatch_device_base_init(1);
  231. std::cout << " huli test :::: " << " t_error = " << t_error << std::endl;
  232. std::this_thread::sleep_for(std::chrono::seconds(2));
  233. std::shared_ptr<Task_Base> tp_task_Base21(new Carrier_task);
  234. Carrier_task * tp_carrier_task21 = (Carrier_task *)tp_task_Base21.get();
  235. tp_carrier_task21->task_init(NULL,std::chrono::milliseconds(15000));
  236. tp_carrier_task21->m_request_key = "x23456789012345678901234567890c1";
  237. // tp_carrier_task21->m_request_x = 1;
  238. tp_carrier_task21->m_request_x = 32600;
  239. tp_carrier_task21->m_request_y = 3000;
  240. tp_carrier_task21->m_request_z = 2525;
  241. tp_carrier_task21->m_request_y1 = 4500;
  242. tp_carrier_task21->m_request_y2 = 1700;
  243. tp_carrier_task21->m_request_clamp_motion = Carrier_task::E_CLAMP_LOOSE;
  244. tp_carrier_task21->m_request_joint_motion_x = Carrier_task::E_JOINT_HOLD_OUT;
  245. tp_carrier_task21->m_request_joint_motion_y = Carrier_task::E_JOINT_HOLD_OUT;
  246. tp_carrier_task21->m_request_space_id = 555;
  247. tp_carrier_task21->m_request_floor_id = 555;
  248. tp_carrier_task21->m_request_wheelbase = 555;
  249. t_error = t_carrier21.execute_task(tp_task_Base21, Dispatch_device_base::DISPATCH_TASK_ONE_LEVEL);
  250. std::cout << " huli test :::: " << " t_error = " << t_error << std::endl;
  251. std::cout << " ---------------------------------------------------" << std::endl;
  252. /*
  253. char zxczxcxzc21 ;
  254. std::cin >> zxczxcxzc21 ;
  255. while ( 1 )
  256. {
  257. std::cout << " huli test :::: " << " ===================================== " << std::endl;
  258. std::cout << " huli test :::: " << " tp_carrier_task->get_task_statu = " << tp_carrier_task->get_task_statu() << std::endl;
  259. std::cout << " huli test :::: " << " tp_carrier_task->m_respons_status = " << tp_carrier_task->m_respons_status << std::endl;
  260. std::cout << " huli test :::: " << " m_respons_key = " << tp_carrier_task->m_respons_key << std::endl;
  261. std::cout << " huli test :::: " << " m_respons_status = " << tp_carrier_task->m_respons_status << std::endl;
  262. std::cout << " huli test :::: " << " m_respons_x = " << tp_carrier_task->m_respons_x << std::endl;
  263. std::cout << " huli test :::: " << " m_respons_y = " << tp_carrier_task->m_respons_y << std::endl;
  264. std::cout << " huli test :::: " << " m_respons_z = " << tp_carrier_task->m_respons_z << std::endl;
  265. std::cout << " huli test :::: " << " m_respons_y1 = " << tp_carrier_task->m_respons_y1 << std::endl;
  266. std::cout << " huli test :::: " << " m_respons_y2 = " << tp_carrier_task->m_respons_y2 << std::endl;
  267. std::cout << " huli test :::: " << " m_respons_clamp_motion = " << tp_carrier_task->m_respons_clamp_motion << std::endl;
  268. std::cout << " huli test :::: " << " m_respons_joint_motion_x = " << tp_carrier_task->m_respons_joint_motion_x << std::endl;
  269. std::cout << " huli test :::: " << " m_respons_joint_motion_y = " << tp_carrier_task->m_respons_joint_motion_y << std::endl;
  270. std::cout << " huli test :::: " << " m_respons_space_id = " << tp_carrier_task->m_respons_space_id << std::endl;
  271. std::cout << " huli test :::: " << " m_respons_floor_id = " << tp_carrier_task->m_respons_floor_id << std::endl;
  272. std::cout << " huli test :::: " << " m_respons_wheelbase = " << tp_carrier_task->m_respons_wheelbase << std::endl;
  273. std::cout << " ---------------------------------------------------" << std::endl;
  274. std::cout << " huli test :::: " << " *********************************************** = " << std::endl;
  275. std::cout << " huli test :::: " << " t_carrier_base.get_carrier_status() = " << t_carrier.get_dispatch_device_status() << std::endl;
  276. int heat = t_carrier.m_last_heartbeat;
  277. std::cout << " huli test :::: " << " m_last_heartbeat = " << heat << std::endl;
  278. std::cout << " huli test :::: " << " m_actual_device_status = " << t_carrier.m_actual_device_status << std::endl;
  279. std::cout << " huli test :::: " << " m_actual_load_status = " << t_carrier.m_actual_load_status << std::endl;
  280. std::cout << " huli test :::: " << " m_actual_x = " << t_carrier.m_actual_x << std::endl;
  281. std::cout << " huli test :::: " << " m_actual_y = " << t_carrier.m_actual_y << std::endl;
  282. std::cout << " huli test :::: " << " m_actual_z = " << t_carrier.m_actual_z << std::endl;
  283. std::cout << " huli test :::: " << " m_actual_y1 = " << t_carrier.m_actual_y1 << std::endl;
  284. std::cout << " huli test :::: " << " m_actual_y2 = " << t_carrier.m_actual_y2 << std::endl;
  285. std::cout << " huli test :::: " << " m_actual_clamp_motion1 = " << t_carrier.m_actual_clamp_motion1 << std::endl;
  286. std::cout << " huli test :::: " << " m_actual_clamp_motion2 = " << t_carrier.m_actual_clamp_motion2 << std::endl;
  287. std::cout << " huli test :::: " << " m_actual_small_sports_car_motion = " << t_carrier.m_actual_small_sports_car_motion << std::endl;
  288. std::cout << " huli test :::: " << " m_actual_joint_motion_x1 = " << t_carrier.m_actual_joint_motion_x1 << std::endl;
  289. std::cout << " huli test :::: " << " m_actual_joint_motion_x2 = " << t_carrier.m_actual_joint_motion_x2 << std::endl;
  290. std::cout << " huli test :::: " << " m_actual_error_code = " << std::endl;
  291. for (int i = 0; i < 50; ++i)
  292. {
  293. printf("0x%x ", t_carrier.m_actual_error_code[i]);
  294. }
  295. std::cout << std::endl;
  296. std::cout << " huli test :::: " << " m_actual_warning_code = " << std::endl;
  297. for (int i = 0; i < 50; ++i)
  298. {
  299. printf("0x%x ", t_carrier.m_actual_warning_code[i]);
  300. }
  301. std::cout << std::endl;
  302. std::cout << " huli test :::: " << " m_actual_error_description = " << t_carrier.m_actual_error_description << std::endl;
  303. std::cout << " huli test :::: " << " *********************************************** = " << std::endl;
  304. std::this_thread::sleep_for(std::chrono::milliseconds(1000));
  305. }
  306. */
  307. Carrier t_carrier22;
  308. t_error = t_carrier22.dispatch_device_base_init(2);
  309. std::cout << " huli test :::: " << " t_error = " << t_error << std::endl;
  310. std::this_thread::sleep_for(std::chrono::seconds(2));
  311. std::shared_ptr<Task_Base> tp_task_Base22(new Carrier_task);
  312. Carrier_task * tp_carrier_task22 = (Carrier_task *)tp_task_Base22.get();
  313. tp_carrier_task22->task_init(NULL,std::chrono::milliseconds(15000));
  314. tp_carrier_task22->m_request_key = "x23456789012345678901234567890c2";
  315. tp_carrier_task22->m_request_x = 24855;
  316. // tp_carrier_task22->m_request_x = 4700;
  317. tp_carrier_task22->m_request_y = 3000;
  318. tp_carrier_task22->m_request_z = 5125;
  319. tp_carrier_task22->m_request_y1 = 4500;
  320. tp_carrier_task22->m_request_y2 = 1700;
  321. tp_carrier_task22->m_request_clamp_motion = Carrier_task::E_CLAMP_LOOSE;
  322. tp_carrier_task22->m_request_joint_motion_x = Carrier_task::E_JOINT_HOLD_OUT;
  323. tp_carrier_task22->m_request_joint_motion_y = Carrier_task::E_JOINT_HOLD_OUT;
  324. tp_carrier_task22->m_request_space_id = 555;
  325. tp_carrier_task22->m_request_floor_id = 555;
  326. tp_carrier_task22->m_request_wheelbase = 555;
  327. t_error = t_carrier22.execute_task(tp_task_Base22, Dispatch_device_base::DISPATCH_TASK_ONE_LEVEL);
  328. std::cout << " huli test :::: " << " t_error = " << t_error << std::endl;
  329. std::cout << " ---------------------------------------------------" << std::endl;
  330. /*
  331. char zxczxcxzc22 ;
  332. std::cin >> zxczxcxzc22 ;
  333. while ( 1 )
  334. {
  335. std::cout << " huli test :::: " << " ===================================== " << std::endl;
  336. std::cout << " huli test :::: " << " tp_carrier_task->get_task_statu = " << tp_carrier_task->get_task_statu() << std::endl;
  337. std::cout << " huli test :::: " << " tp_carrier_task->m_respons_status = " << tp_carrier_task->m_respons_status << std::endl;
  338. std::cout << " huli test :::: " << " m_respons_key = " << tp_carrier_task->m_respons_key << std::endl;
  339. std::cout << " huli test :::: " << " m_respons_status = " << tp_carrier_task->m_respons_status << std::endl;
  340. std::cout << " huli test :::: " << " m_respons_x = " << tp_carrier_task->m_respons_x << std::endl;
  341. std::cout << " huli test :::: " << " m_respons_y = " << tp_carrier_task->m_respons_y << std::endl;
  342. std::cout << " huli test :::: " << " m_respons_z = " << tp_carrier_task->m_respons_z << std::endl;
  343. std::cout << " huli test :::: " << " m_respons_y1 = " << tp_carrier_task->m_respons_y1 << std::endl;
  344. std::cout << " huli test :::: " << " m_respons_y2 = " << tp_carrier_task->m_respons_y2 << std::endl;
  345. std::cout << " huli test :::: " << " m_respons_clamp_motion = " << tp_carrier_task->m_respons_clamp_motion << std::endl;
  346. std::cout << " huli test :::: " << " m_respons_joint_motion_x = " << tp_carrier_task->m_respons_joint_motion_x << std::endl;
  347. std::cout << " huli test :::: " << " m_respons_joint_motion_y = " << tp_carrier_task->m_respons_joint_motion_y << std::endl;
  348. std::cout << " huli test :::: " << " m_respons_space_id = " << tp_carrier_task->m_respons_space_id << std::endl;
  349. std::cout << " huli test :::: " << " m_respons_floor_id = " << tp_carrier_task->m_respons_floor_id << std::endl;
  350. std::cout << " huli test :::: " << " m_respons_wheelbase = " << tp_carrier_task->m_respons_wheelbase << std::endl;
  351. std::cout << " ---------------------------------------------------" << std::endl;
  352. std::cout << " huli test :::: " << " *********************************************** = " << std::endl;
  353. std::cout << " huli test :::: " << " t_carrier_base.get_carrier_status() = " << t_carrier.get_dispatch_device_status() << std::endl;
  354. int heat = t_carrier.m_last_heartbeat;
  355. std::cout << " huli test :::: " << " m_last_heartbeat = " << heat << std::endl;
  356. std::cout << " huli test :::: " << " m_actual_device_status = " << t_carrier.m_actual_device_status << std::endl;
  357. std::cout << " huli test :::: " << " m_actual_load_status = " << t_carrier.m_actual_load_status << std::endl;
  358. std::cout << " huli test :::: " << " m_actual_x = " << t_carrier.m_actual_x << std::endl;
  359. std::cout << " huli test :::: " << " m_actual_y = " << t_carrier.m_actual_y << std::endl;
  360. std::cout << " huli test :::: " << " m_actual_z = " << t_carrier.m_actual_z << std::endl;
  361. std::cout << " huli test :::: " << " m_actual_y1 = " << t_carrier.m_actual_y1 << std::endl;
  362. std::cout << " huli test :::: " << " m_actual_y2 = " << t_carrier.m_actual_y2 << std::endl;
  363. std::cout << " huli test :::: " << " m_actual_clamp_motion1 = " << t_carrier.m_actual_clamp_motion1 << std::endl;
  364. std::cout << " huli test :::: " << " m_actual_clamp_motion2 = " << t_carrier.m_actual_clamp_motion2 << std::endl;
  365. std::cout << " huli test :::: " << " m_actual_small_sports_car_motion = " << t_carrier.m_actual_small_sports_car_motion << std::endl;
  366. std::cout << " huli test :::: " << " m_actual_joint_motion_x1 = " << t_carrier.m_actual_joint_motion_x1 << std::endl;
  367. std::cout << " huli test :::: " << " m_actual_joint_motion_x2 = " << t_carrier.m_actual_joint_motion_x2 << std::endl;
  368. std::cout << " huli test :::: " << " m_actual_error_code = " << std::endl;
  369. for (int i = 0; i < 50; ++i)
  370. {
  371. printf("0x%x ", t_carrier.m_actual_error_code[i]);
  372. }
  373. std::cout << std::endl;
  374. std::cout << " huli test :::: " << " m_actual_warning_code = " << std::endl;
  375. for (int i = 0; i < 50; ++i)
  376. {
  377. printf("0x%x ", t_carrier.m_actual_warning_code[i]);
  378. }
  379. std::cout << std::endl;
  380. std::cout << " huli test :::: " << " m_actual_error_description = " << t_carrier.m_actual_error_description << std::endl;
  381. std::cout << " huli test :::: " << " *********************************************** = " << std::endl;
  382. std::this_thread::sleep_for(std::chrono::milliseconds(1000));
  383. }
  384. */
  385. /*
  386. Passageway t_passageway;
  387. t_error = t_passageway.dispatch_device_base_init(1);
  388. std::cout << " huli test :::: " << " t_error = " << t_error << std::endl;
  389. std::this_thread::sleep_for(std::chrono::seconds(2));
  390. std::shared_ptr<Task_Base> tp_task_Base3(new Passageway_task);
  391. Passageway_task * tp_passageway_task = (Passageway_task *)tp_task_Base3.get();
  392. tp_passageway_task->task_init(NULL,std::chrono::milliseconds(15000));
  393. tp_passageway_task->m_request_key = "ABCDEF";
  394. tp_passageway_task->m_request_inside_door_motion = Passageway_task::DOOR_OPEN;
  395. tp_passageway_task->m_request_outside_door_motion = Passageway_task::DOOR_CLOSE;
  396. tp_passageway_task->m_request_turntable_direction = Passageway_task::TURNTABLE_DIRECTION_OUTSIDE;
  397. t_error = t_passageway.execute_task(tp_task_Base3, Dispatch_device_base::E_ONE_LEVEL);
  398. std::cout << " huli test :::: " << " t_error = " << t_error << std::endl;
  399. std::cout << " ---------------------------------------------------" << std::endl;
  400. char zxczxcxzc3 ;
  401. std::cin >> zxczxcxzc3 ;
  402. while ( 1 )
  403. {
  404. std::cout << " huli test :::: " << " ===================================== " << std::endl;
  405. std::cout << " huli test :::: " << " tp_passageway_task->get_task_statu = " << tp_passageway_task->get_task_statu() << std::endl;
  406. std::cout << " huli test :::: " << " tp_passageway_task->m_respons_status = " << tp_passageway_task->m_respons_status << std::endl;
  407. std::cout << " huli test :::: " << " m_respons_key = " << tp_passageway_task->m_respons_key << std::endl;
  408. std::cout << " huli test :::: " << " m_respons_status = " << tp_passageway_task->m_respons_status << std::endl;
  409. std::cout << " huli test :::: " << " m_respons_inside_door_motion = " << tp_passageway_task->m_respons_inside_door_motion << std::endl;
  410. std::cout << " huli test :::: " << " m_respons_outside_door_motion = " << tp_passageway_task->m_respons_outside_door_motion << std::endl;
  411. std::cout << " huli test :::: " << " m_respons_turntable_direction = " << tp_passageway_task->m_respons_turntable_direction << std::endl;
  412. std::cout << " ---------------------------------------------------" << std::endl;
  413. std::cout << " huli test :::: " << " *********************************************** = " << std::endl;
  414. std::cout << " huli test :::: " << " t_passageway_base.get_passageway_status() = " << t_passageway.get_dispatch_device_status() << std::endl;
  415. int heat = t_passageway.m_last_heartbeat;
  416. std::cout << " huli test :::: " << " m_last_heartbeat = " << heat << std::endl;
  417. std::cout << " huli test :::: " << " m_actual_device_status = " << t_passageway.m_actual_device_status << std::endl;
  418. std::cout << " huli test :::: " << " m_actual_inside_load_status = " << t_passageway.m_actual_inside_load_status << std::endl;
  419. std::cout << " huli test :::: " << " m_actual_outside_load_status = " << t_passageway.m_actual_outside_load_status << std::endl;
  420. std::cout << " huli test :::: " << " m_actual_front_overstep_the_boundary = " << t_passageway.m_actual_front_overstep_the_boundary << std::endl;
  421. std::cout << " huli test :::: " << " m_actual_back_overstep_the_boundary = " << t_passageway.m_actual_back_overstep_the_boundary << std::endl;
  422. std::cout << " huli test :::: " << " m_actual_height_overstep_the_boundary = " << t_passageway.m_actual_height_overstep_the_boundary << std::endl;
  423. std::cout << " huli test :::: " << " m_actual_outside_door_sensor = " << t_passageway.m_actual_outside_door_sensor << std::endl;
  424. std::cout << " huli test :::: " << " m_actual_inside_door_motion = " << t_passageway.m_actual_inside_door_motion << std::endl;
  425. std::cout << " huli test :::: " << " m_actual_outside_door_motion = " << t_passageway.m_actual_outside_door_motion << std::endl;
  426. std::cout << " huli test :::: " << " m_actual_turntable_load_status = " << t_passageway.m_actual_turntable_load_status << std::endl;
  427. std::cout << " huli test :::: " << " m_actual_turntable_direction = " << t_passageway.m_actual_turntable_direction << std::endl;
  428. std::cout << " huli test :::: " << " m_actual_error_code = " << std::endl;
  429. for (int i = 0; i < 50; ++i)
  430. {
  431. printf("0x%x ", t_passageway.m_actual_error_code[i]);
  432. }
  433. std::cout << std::endl;
  434. std::cout << " huli test :::: " << " m_actual_warning_code = " << std::endl;
  435. for (int i = 0; i < 50; ++i)
  436. {
  437. printf("0x%x ", t_passageway.m_actual_warning_code[i]);
  438. }
  439. std::cout << std::endl;
  440. std::cout << " huli test :::: " << " m_actual_error_description = " << t_passageway.m_actual_error_description << std::endl;
  441. std::cout << " huli test :::: " << " *********************************************** = " << std::endl;
  442. std::this_thread::sleep_for(std::chrono::milliseconds(1000));
  443. }
  444. */
  445. while (1)
  446. {
  447. }
  448. char ch123 ;
  449. std::cin >> ch123 ;
  450. Dispatch_communication::get_instance_references().communication_uninit();
  451. return 0;
  452. int t_dispatch_id = 0;
  453. // std::cin >> t_dispatch_id ;
  454. if ( argc == 2 )
  455. {
  456. std::cout << " huli test :::: " << " argv[1] = " << argv[1] << std::endl;
  457. t_dispatch_id = atoi(argv[1]);
  458. }
  459. std::cout << " huli test :::: " << " t_dispatch_id = " << t_dispatch_id << std::endl;
  460. Dispatch_manager::get_instance_references().dispatch_manager_init(t_dispatch_id);
  461. std::cout << "Dispatch_manager = " << Dispatch_manager::get_instance_references().get_dispatch_manager_status() << std::endl;
  462. System_executor::get_instance_references().system_executor_init(8);
  463. std::cout << "System_executor = " << System_executor::get_instance_references().get_system_executor_status() << std::endl;
  464. System_communication::get_instance_references().communication_init();
  465. char ch ;
  466. std::cin >> ch ;
  467. System_communication::get_instance_references().communication_uninit();
  468. System_executor::get_instance_references().system_executor_uninit();
  469. Dispatch_manager::get_instance_references().dispatch_manager_uninit();
  470. return 0;
  471. }