custom_type.h 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177
  1. //
  2. // Created by gf on 23-7-21.
  3. // 自定义类型
  4. //
  5. #ifndef NAVIGATION_CUSTOM_TYPE_H
  6. #define NAVIGATION_CUSTOM_TYPE_H
  7. #include <map>
  8. //////////////////////////////////////////////////
  9. /// 封装的enum模板类,解决原生enum无法参与位运算问题
  10. template<typename Enum>
  11. class MyEnum {
  12. using Self = MyEnum<Enum>;
  13. using EnumType = Enum;
  14. public:
  15. MyEnum(const MyEnum &other)
  16. : i(other.i) {
  17. }
  18. MyEnum(const Enum &e)
  19. : i((int) e) {
  20. }
  21. MyEnum(const int ival)
  22. : i(ival) {
  23. }
  24. operator int() const {
  25. return i;
  26. }
  27. MyEnum operator|(const MyEnum &another) {
  28. MyEnum g;
  29. g.i = another.i | Self::i;
  30. return g;
  31. }
  32. MyEnum operator|(const EnumType f) {
  33. return *this | MyEnum(f);
  34. }
  35. MyEnum operator&(const MyEnum &another) {
  36. MyEnum g;
  37. g.i = another.i & Self::i;
  38. return g;
  39. }
  40. MyEnum operator&(const EnumType f) {
  41. return *this & MyEnum(f);
  42. }
  43. private:
  44. int i;
  45. };
  46. //////////////////////////////////////////////////
  47. //////////////////////////////////////////////////
  48. /// MPC返回值
  49. enum MpcError {
  50. success = 0,
  51. no_solution = 1,
  52. failed = 2,
  53. unknown
  54. };
  55. //////////////////////////////////////////////////
  56. //////////////////////////////////////////////////
  57. /// 基准可选方向
  58. enum Direction {
  59. eForward = 0x0001,
  60. eBackward = 0x0002,
  61. eLeft = 0x0004,
  62. eRight = 0x0008
  63. };
  64. //////////////////////////////////////////////////
  65. //////////////////////////////////////////////////
  66. /// AGV运动模式(最低1位:0单车,1整车。低2位:0同向,1反向。低3位:0主车在前,1主车在后)
  67. enum ActionMode{
  68. eSingle = 0x0000,
  69. eDouble = 0x0001,
  70. eMainInForward = 0x0000,
  71. eMainInBackward = 0x0008,
  72. eChildSameToMain = 0x0000,
  73. eChildOppositeToMain = 0x0002
  74. };
  75. //using ActionModes = MyEnum<ActionMode>;
  76. //////////////////////////////////////////////////
  77. //////////////////////////////////////////////////
  78. /// AGV指令类型
  79. enum ActionType {
  80. eReady = 0,
  81. eStop = 0,
  82. eRotation = 1,
  83. eHorizontal = 2,
  84. eVertical = 3,
  85. eClampClose = 5,
  86. eClampHalfOpen = 6,
  87. eLifterRise = 7, //提升机构上升
  88. eLifterDown =8,
  89. eClampFullyOpen = 9
  90. };
  91. //////////////////////////////////////////////////
  92. //////////////////////////////////////////////////
  93. /// 提升机构运动状态
  94. enum LifterStatus {
  95. eInvalid = 0,
  96. eRose = 1,//上升到位
  97. eDowned = 2//下降到位
  98. };
  99. //////////////////////////////////////////////////
  100. //////////////////////////////////////////////////
  101. /// 并行夹持和提升机构运作
  102. enum eClamLiftActionType{
  103. eByteCLampClose = 1,
  104. eByteClampHalfOpen=2,
  105. eByteClampFullyOpen=4,
  106. eByteLifterDown=8,
  107. eByteLifterUp=16
  108. };
  109. //////////////////////////////////////////////////
  110. //////////////////////////////////////////////////
  111. /// 指令流程类型
  112. enum eSequenceType{
  113. eSequenceDefault = 0,
  114. eSequencePark = 1,
  115. eSequencePick = 2
  116. };
  117. //////////////////////////////////////////////////
  118. //////////////////////////////////////////////////
  119. /// plc区域+编号载车板 对应 车位表
  120. enum eRegionId{
  121. eRegion0 = 0,
  122. eRegion1 = 1,
  123. eRegion2,
  124. eRegion3,
  125. eRegion4,
  126. eRegion5,
  127. eRegion6,
  128. eRegion7,
  129. eRegion8,
  130. eRegion9,
  131. eRegion10,
  132. eRegion11
  133. };
  134. enum eCarrierIdInRegionId{
  135. eCarrier0 = 0,
  136. eCarrier1 = 1,
  137. eCarrier2,
  138. eCarrier3,
  139. eCarrier4,
  140. eCarrier5,
  141. eCarrier6,
  142. eCarrier7,
  143. eCarrier8,
  144. eCarrier9,
  145. eCarrier10,
  146. eCarrier11
  147. };
  148. typedef std::pair<short, short > Region_Carry;
  149. typedef std::map<int ,Region_Carry> SpaceNo2Region_Carry;
  150. //////////////////////////////////////////////////
  151. #endif //NAVIGATION_CUSTOM_TYPE_H