123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290 |
- //
- // huli test 20200223
- //
- #include <iostream>
- #include "./error_code/error_code.h"
- //#include "LogFiles.h"
- #include <glog/logging.h>
- #include "./communication/communication_socket_base.h"
- #include "./tool/thread_pool.h"
- #include "./system/system_communication.h"
- #include "./system/system_executor.h"
- #include "./dispatch/dispatch_manager.h"
- #include "./dispatch/dispatch_communication.h"
- #include <algorithm> // std::for_each
- #define LIVOX_NUMBER 2
- GOOGLE_GLOG_DLL_DECL void shut_down_logging(const char* data, int size)
- {
- time_t tt;
- time( &tt );
- tt = tt + 8*3600; // transform the time zone
- tm* t= gmtime( &tt );
- char buf[255]={0};
- sprintf(buf,"./%d%02d%02d-%02d%02d%02d-dump.txt",
- t->tm_year + 1900,
- t->tm_mon + 1,
- t->tm_mday,
- t->tm_hour,
- t->tm_min,
- t->tm_sec);
- FILE* tp_file=fopen(buf,"w");
- fprintf(tp_file,data,strlen(data));
- fclose(tp_file);
- }
- #include <chrono>
- using namespace std;
- void myfunction (int i) { // function:
- std::cout << ' ' << i;
- }
- class AAA
- {
- public:
- int a;
- };
- class BBB:public AAA
- {
- public:
- int b;
- };
- class CCC:public AAA
- {
- public:
- int c;
- };
- int main(int argc,char* argv[])
- {
- const char* logPath = "./";
- google::InitGoogleLogging("LidarMeasurement");
- google::SetStderrLogging(google::INFO);
- google::SetLogDestination(0, logPath);
- google::SetLogFilenameExtension("zxlog");
- google::InstallFailureSignalHandler();
- google::InstallFailureWriter(&shut_down_logging);
- FLAGS_colorlogtostderr = true; // Set log color
- FLAGS_logbufsecs = 0; // Set log output speed(s)
- FLAGS_max_log_size = 1024; // Set max log file size(GB)
- FLAGS_stop_logging_if_full_disk = true;
- Error_manager t_error;
- t_error = Dispatch_communication::get_instance_references().communication_init();
- std::cout << " huli test :::: " << " t_error = " << t_error << std::endl;
- std::cout << "Dispatch_communication = " << Dispatch_communication::get_instance_references().get_status() << std::endl;
- std::this_thread::sleep_for(std::chrono::seconds(2));
- std::cout << " huli test :::: " << " t_error = " << t_error << std::endl;
- std::cout << "Dispatch_communication = " << Dispatch_communication::get_instance_references().get_status() << std::endl;
- std::cout << " ---------------------------------------------------" << std::endl;
- std::cout << " ---------------------------------------------------" << std::endl;
- Catcher t_catcher;
- t_error = t_catcher.dispatch_device_base_init(1);
- std::cout << " huli test :::: " << " t_error = " << t_error << std::endl;
- std::this_thread::sleep_for(std::chrono::seconds(2));
- std::shared_ptr<Task_Base> tp_task_Base(new Catcher_task);
- Catcher_task * tp_catcher_task = (Catcher_task *)tp_task_Base.get();
- tp_catcher_task->task_init(NULL,std::chrono::milliseconds(15000));
- tp_catcher_task->m_request_key = "ABCDEF";
- tp_catcher_task->m_request_x = 123;
- tp_catcher_task->m_request_y = 456;
- tp_catcher_task->m_request_b = 80;
- tp_catcher_task->m_request_z = 789;
- tp_catcher_task->m_request_d1 = 333;
- tp_catcher_task->m_request_d2 = 444;
- tp_catcher_task->m_request_wheelbase = 555;
- tp_catcher_task->m_request_clamp_motion = Catcher_task::E_CLAMP_LOOSE;
- t_error = t_catcher.execute_task(tp_task_Base, Dispatch_device_base::E_ONE_LEVEL);
- std::cout << " huli test :::: " << " t_error = " << t_error << std::endl;
- std::cout << " ---------------------------------------------------" << std::endl;
- char zxczxcxzc ;
- std::cin >> zxczxcxzc ;
- while ( 1 )
- {
- std::cout << " huli test :::: " << " ===================================== " << std::endl;
- std::cout << " huli test :::: " << " tp_catcher_task->get_task_statu = " << tp_catcher_task->get_task_statu() << std::endl;
- std::cout << " huli test :::: " << " tp_catcher_task->m_respons_status = " << tp_catcher_task->m_respons_status << std::endl;
- std::cout << " huli test :::: " << " m_respons_key = " << tp_catcher_task->m_respons_key << std::endl;
- std::cout << " huli test :::: " << " m_respons_status = " << tp_catcher_task->m_respons_status << std::endl;
- std::cout << " huli test :::: " << " m_respons_x = " << tp_catcher_task->m_respons_x << std::endl;
- std::cout << " huli test :::: " << " m_respons_y = " << tp_catcher_task->m_respons_y << std::endl;
- std::cout << " huli test :::: " << " m_respons_b = " << tp_catcher_task->m_respons_b << std::endl;
- std::cout << " huli test :::: " << " m_respons_z = " << tp_catcher_task->m_respons_z << std::endl;
- std::cout << " huli test :::: " << " m_respons_d1 = " << tp_catcher_task->m_respons_d1 << std::endl;
- std::cout << " huli test :::: " << " m_respons_d2 = " << tp_catcher_task->m_respons_d2 << std::endl;
- std::cout << " huli test :::: " << " m_respons_wheelbase = " << tp_catcher_task->m_respons_wheelbase << std::endl;
- std::cout << " huli test :::: " << " m_respons_clamp_motion = " << tp_catcher_task->m_respons_clamp_motion << std::endl;
- std::cout << " huli test :::: " << " t_carrier_base.get_carrier_status() = " << t_catcher.get_dispatch_device_status() << std::endl;
- std::cout << " huli test :::: " << " t_carrier_base.get_carrier_status() = " << t_catcher.get_actual_device_status() << std::endl;
- std::cout << " ---------------------------------------------------" << std::endl;
- std::this_thread::sleep_for(std::chrono::milliseconds(1000));
- }
- Catcher t_catcher;
- t_error = t_catcher.dispatch_device_base_init(1);
- std::cout << " huli test :::: " << " t_error = " << t_error << std::endl;
- std::this_thread::sleep_for(std::chrono::seconds(2));
- std::shared_ptr<Task_Base> tp_task_Base(new Catcher_task);
- Catcher_task * tp_catcher_task = (Catcher_task *)tp_task_Base.get();
- tp_catcher_task->task_init(NULL,std::chrono::milliseconds(15000));
- tp_catcher_task->m_request_key = "ABCDEF";
- tp_catcher_task->m_request_x = 123;
- tp_catcher_task->m_request_y = 456;
- tp_catcher_task->m_request_b = 80;
- tp_catcher_task->m_request_z = 789;
- tp_catcher_task->m_request_d1 = 333;
- tp_catcher_task->m_request_d2 = 444;
- tp_catcher_task->m_request_wheelbase = 555;
- tp_catcher_task->m_request_clamp_motion = Catcher_task::E_CLAMP_LOOSE;
- t_error = t_catcher.execute_task(tp_task_Base, Dispatch_device_base::E_ONE_LEVEL);
- std::cout << " huli test :::: " << " t_error = " << t_error << std::endl;
- std::cout << " ---------------------------------------------------" << std::endl;
- char zxczxcxzc ;
- std::cin >> zxczxcxzc ;
- while ( 1 )
- {
- std::cout << " huli test :::: " << " ===================================== " << std::endl;
- std::cout << " huli test :::: " << " tp_catcher_task->get_task_statu = " << tp_catcher_task->get_task_statu() << std::endl;
- std::cout << " huli test :::: " << " tp_catcher_task->m_respons_status = " << tp_catcher_task->m_respons_status << std::endl;
- std::cout << " huli test :::: " << " m_respons_key = " << tp_catcher_task->m_respons_key << std::endl;
- std::cout << " huli test :::: " << " m_respons_status = " << tp_catcher_task->m_respons_status << std::endl;
- std::cout << " huli test :::: " << " m_respons_x = " << tp_catcher_task->m_respons_x << std::endl;
- std::cout << " huli test :::: " << " m_respons_y = " << tp_catcher_task->m_respons_y << std::endl;
- std::cout << " huli test :::: " << " m_respons_b = " << tp_catcher_task->m_respons_b << std::endl;
- std::cout << " huli test :::: " << " m_respons_z = " << tp_catcher_task->m_respons_z << std::endl;
- std::cout << " huli test :::: " << " m_respons_d1 = " << tp_catcher_task->m_respons_d1 << std::endl;
- std::cout << " huli test :::: " << " m_respons_d2 = " << tp_catcher_task->m_respons_d2 << std::endl;
- std::cout << " huli test :::: " << " m_respons_wheelbase = " << tp_catcher_task->m_respons_wheelbase << std::endl;
- std::cout << " huli test :::: " << " m_respons_clamp_motion = " << tp_catcher_task->m_respons_clamp_motion << std::endl;
- std::cout << " huli test :::: " << " t_carrier_base.get_carrier_status() = " << t_catcher.get_dispatch_device_status() << std::endl;
- std::cout << " huli test :::: " << " t_carrier_base.get_carrier_status() = " << t_catcher.get_actual_device_status() << std::endl;
- std::cout << " ---------------------------------------------------" << std::endl;
- std::this_thread::sleep_for(std::chrono::milliseconds(1000));
- }
- char ch123 ;
- std::cin >> ch123 ;
- Dispatch_communication::get_instance_references().communication_uninit();
- return 0;
- int t_dispatch_id = 0;
- // std::cin >> t_dispatch_id ;
- if ( argc == 2 )
- {
- std::cout << " huli test :::: " << " argv[1] = " << argv[1] << std::endl;
- t_dispatch_id = atoi(argv[1]);
- }
- std::cout << " huli test :::: " << " t_dispatch_id = " << t_dispatch_id << std::endl;
- Dispatch_manager::get_instance_references().dispatch_manager_init(t_dispatch_id);
- std::cout << "Dispatch_manager = " << Dispatch_manager::get_instance_references().get_dispatch_manager_status() << std::endl;
- System_executor::get_instance_references().system_executor_init(8);
- std::cout << "System_executor = " << System_executor::get_instance_references().get_system_executor_status() << std::endl;
- System_communication::get_instance_references().communication_init();
- char ch ;
- std::cin >> ch ;
- System_communication::get_instance_references().communication_uninit();
- System_executor::get_instance_references().system_executor_uninit();
- Dispatch_manager::get_instance_references().dispatch_manager_uninit();
- return 0;
- }
|