TerminorComandExecutor.h 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. //
  2. // Created by zx on 2019/12/27.
  3. //
  4. #ifndef TERMINOR_H
  5. #define TERMINOR_H
  6. #include "Laser.h"
  7. #include "ModbusPlc.h"
  8. #include "Terminor_parameter.pb.h"
  9. /*
  10. * 终端指令执行状态,枚举
  11. * 列举终端指令从进入流程到测量完成过程中的进度状态
  12. */
  13. enum TerminorStatu
  14. {
  15. TERMINOR_READY=0, //终端空闲
  16. TERMINOR_WAIT_LASER, //终端收到指令,等待雷达资源
  17. TERMINOR_SCANNING, //终端指令一启动扫描,扫描中
  18. TERMINOR_WAIT_MEASURE, //终端指令扫描完成,指令进入等待测量中
  19. TERMINOR_MEASURING, //终端指令进入测量中
  20. TERMINOR_UNKNOW //未知状态
  21. };
  22. /*
  23. * 终端指令执行类,执行指令,监控指令执行进度
  24. * 输入雷达数组,plc对象,测量算法对象,执行扫描测量任务
  25. */
  26. class TerminorCommandExecutor
  27. {
  28. public:
  29. /*
  30. * 构造函数
  31. * parameter:该终端指令配置参数(待定)
  32. */
  33. TerminorCommandExecutor(LidarMeasure::Terminor_parameter parameter);
  34. /*
  35. * 获取终端进度状态
  36. */
  37. int get_statu(TerminorStatu& statu);
  38. /*
  39. * 执行扫描,测量任务,阻塞知道任务完成或超时(单位秒)
  40. *lasers:需要启动的雷达
  41. * plc:上传结果工具
  42. * locater:测量算法对象
  43. */
  44. int execute_command(std::vector<Laser*> lasers,ModbusPlc* plc,
  45. Locater* locater,int timeout=15);
  46. /*
  47. * 强制正在执行的中断指令
  48. */
  49. int force_stop_command();
  50. protected:
  51. };
  52. #endif //TERMINOR_H