正点原子开发板 alientek_develop_board cancmder
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

208 lines
5.1 KiB

2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
  1. #pragma once
  2. #include "sdk/os/zos.hpp"
  3. #include "sdk\components\zprotocols\zcancmder_v2\api\api.hpp"
  4. #include "sdk\components\zprotocols\zcancmder_v2\zmodule_device_manager.hpp"
  5. #define ZMOTOR_ID 4
  6. #define XYRobot_ID 3
  7. #define XYRobot_HOOK_ID 21
  8. namespace iflytop {
  9. using namespace std;
  10. class IntelligentWindingRobotCtrl {
  11. public:
  12. typedef struct {
  13. /**
  14. * @brief ŷ϶
  15. */
  16. int32_t paifei_duoji_reset_pos;
  17. int32_t paifei_duoji_press_pos;
  18. int32_t paifei_duoji_press_torque;
  19. /**
  20. * @brief ̽
  21. */
  22. int32_t raoxiantance_duoji_reset_pos;
  23. int32_t raoxiantance_duoji_tance_zero_pos;
  24. /**
  25. * @brief ѹ߶
  26. */
  27. int32_t yaxian_duoji_reset_pos;
  28. int32_t yaxian_duoji_press_pos;
  29. int32_t yaxian_duoji_press_torque;
  30. int32_t yaxian_duoji_wait_for_press_pos;
  31. /**
  32. * @brief
  33. */
  34. int32_t xianlajin_duoji_reset_pos;
  35. int32_t xianlajin_duoji_line_entry_pos;
  36. int32_t xianlajin_duoji_tight_line_pos;
  37. int32_t xianlajin_duoji_loose_line_pos;
  38. /**
  39. * @brief ߼н
  40. */
  41. int32_t jiaxian_duoji_reset_pos;
  42. int32_t jiaxian_duoji_clamp_pos;
  43. int32_t jiaxian_duoji_clamp_torque;
  44. /**
  45. * @brief еۼ߶
  46. */
  47. int32_t arm_jiaxian_duoji_reset_pos;
  48. int32_t arm_jiaxian_duoji_clamp_direction;
  49. int32_t arm_jiaxian_duoji_clamp_torque;
  50. /**
  51. * @brief
  52. */
  53. int32_t scissors_reset_pos;
  54. int32_t m22_scissors_cut_pos;
  55. /**
  56. * @brief צ
  57. */
  58. int32_t m21_arm_hook_claws_half_pos;
  59. int32_t m21_arm_hook_claws_full_pos;
  60. /**
  61. * @brief Zλ
  62. */
  63. int32_t z_axis_take_line_pos;
  64. int32_t z_axis_take_clip_pos;
  65. int32_t z_axis_winding_hight;
  66. /**
  67. * @brief XYƽ̨
  68. */
  69. int32_t xy_platform_winding_pos_x;
  70. int32_t xy_platform_winding_pos_y;
  71. int32_t xy_platform_takeline_pos_x;
  72. int32_t xy_platform_takeline_pos_y;
  73. int32_t xy_platform_takeline_clip00_pos_x; //
  74. int32_t xy_platform_takeline_clip00_pos_y;
  75. int32_t xy_platform_takeline_clipXX_pos_x;
  76. int32_t xy_platform_takeline_clipXX_pos_y;
  77. int32_t clip_line;
  78. int32_t clip_each_line_num;
  79. } config_t;
  80. ZModuleDeviceManager* m_dm;
  81. ICmdParser* m_cmdparse;
  82. config_t cfg;
  83. private:
  84. void wait_module_idle(int32_t moduleid);
  85. void wait_modules_idle(...);
  86. /**
  87. * @brief еۼ߶
  88. */
  89. int32_t m11_arm_jiaxian_duoji_move_to_reset_pos();
  90. int32_t m11_arm_jiaxian_duoji_move_to_clamp_pos();
  91. /**
  92. * @brief ߶
  93. */
  94. int32_t m12_jiaxian_duoji_move_to_reset_pos();
  95. int32_t m12_jiaxian_duoji_move_to_clamp_pos();
  96. /**
  97. * @brief ѹ߶
  98. */
  99. int32_t m13_yaxian_duoji_move_to_reset();
  100. int32_t m13_yaxian_duoji_move_to_press_pos();
  101. int32_t m13_yaxian_duoji_move_to_wait_for_press_pos();
  102. /**
  103. * @brief ̽
  104. */
  105. int32_t m14_raoxiantance_duoji_move_to_reset();
  106. int32_t m14_raoxiantance_duoji_move_to_get_thickness(int32_t* thickness);
  107. // �ŷ϶���
  108. int32_t m15_paifei_duoji_moveto_reset();
  109. int32_t m15_paifei_duoji_moveto_press();
  110. /**
  111. * @brief
  112. */
  113. int32_t m16_xianlajin_duoji_move_to_reset(); // ��λ
  114. int32_t m16_xianlajin_duoji_move_to_line_entry_pos(); // ����λ
  115. int32_t m16_xianlajin_duoji_move_to_tight_line_pos(); // �����
  116. int32_t m16_xianlajin_duoji_move_to_loose_line_pos(); // �����
  117. /**
  118. * @brief е۹צ
  119. */
  120. int32_t m21_arm_hook_claws_reset();
  121. int32_t m21_arm_hook_claws_move_to_half_pos();
  122. int32_t m21_arm_hook_claws_move_to_full_pos();
  123. /**
  124. * @brief
  125. */
  126. int32_t m22_scissors_move_reset_pos(); // block
  127. int32_t m22_scissors_cut(); // block
  128. /**
  129. * @brief ߵ
  130. */
  131. int32_t m23_laxian_motor_move_to_reset_pos(); // block
  132. int32_t m23_laxian_motor_move_to_tight_line_pos(); // block
  133. int32_t device_reset();
  134. int32_t disable_all_motor();
  135. int32_t xy_get_point(int32_t clip_index, int32_t& x, int32_t& y); // ȡ����
  136. int32_t xy_run_to(int32_t x, int32_t y, int32_t zpos = 0, bool jiaxian_duoji_reset = true); // ȡ����
  137. int32_t xy_run_to_clip_pos_test(int32_t clip_index);
  138. int32_t xy_reset();
  139. int32_t zmove_to(int32_t pos);
  140. int32_t zreset();
  141. int32_t xymove_to(int32_t x, int32_t y);
  142. public:
  143. int32_t initialize(ZModuleDeviceManager* dm, ICmdParser* cmdparse);
  144. void regcb();
  145. int32_t initialize_device();
  146. int32_t main_shaft_run();
  147. int32_t main_shaft_stop();
  148. /**
  149. * @brief XYƽ̨
  150. */
  151. int32_t xy_platform_reset();
  152. /**
  153. * @brief Z
  154. */
  155. int32_t z_axis_reset();
  156. int32_t z_axis_move_to(int32_t pos);
  157. int32_t xy_move_to_zero(); // �ƶ�����λ
  158. int32_t xy_take_clip(int32_t index); // ȡ����
  159. int32_t xy_take_line(); // ȡ��
  160. int32_t xy_take_back_clip(); // �ŵ���
  161. int32_t xy_remove_line(); // �Ƴ���
  162. /**
  163. * @brief
  164. */
  165. int32_t start_winding();
  166. int32_t stop_winding();
  167. int32_t reset_and_check_device();
  168. int32_t setcfg(const char* cfgname, int32_t cfgvalue);
  169. int32_t dumpcfg();
  170. int32_t do_reset_device();
  171. int32_t do_winding(int32_t index);
  172. void processError(int32_t err);
  173. };
  174. } // namespace iflytop