正点原子开发板 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.

209 lines
5.0 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
  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 scissors_cut_pos;
  55. /**
  56. * @brief צ
  57. */
  58. int32_t arm_hook_claws_half_pos;
  59. int32_t 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. /**
  74. * @brief
  75. *
  76. *
  77. * 00
  78. *
  79. *
  80. *
  81. * XX
  82. */
  83. int32_t xy_platform_takeline_clip00_pos_x; //
  84. int32_t xy_platform_takeline_clip00_pos_y;
  85. int32_t xy_platform_takeline_clipXX_pos_x;
  86. int32_t xy_platform_takeline_clipXX_pos_y;
  87. int32_t clip_line;
  88. int32_t clip_each_line_num;
  89. } config_t;
  90. ZModuleDeviceManager* m_dm;
  91. ICmdParser* m_cmdparse;
  92. config_t cfg;
  93. private:
  94. int32_t device_reset();
  95. int32_t disable_all_motor();
  96. int32_t xy_get_point(int32_t clip_index, int32_t& x, int32_t& y); // ȡ����
  97. int32_t xy_run_to(int32_t x, int32_t y, int32_t zpos = 0, bool jiaxian_duoji_reset = true); // ȡ����
  98. int32_t xy_run_to_clip_pos_test(int32_t clip_index);
  99. int32_t xy_reset();
  100. int32_t zmove_to(int32_t pos);
  101. int32_t zreset();
  102. int32_t xymove_to(int32_t x, int32_t y);
  103. public:
  104. int32_t initialize(ZModuleDeviceManager* dm, ICmdParser* cmdparse);
  105. void regcb();
  106. int32_t initialize_device();
  107. // �ŷ϶���
  108. int32_t paifei_duoji_moveto_reset();
  109. int32_t paifei_duoji_moveto_press();
  110. /**
  111. * @brief ̽
  112. */
  113. int32_t raoxiantance_duoji_move_to_reset();
  114. int32_t raoxiantance_duoji_move_to_get_thickness(int32_t* thickness);
  115. /**
  116. * @brief ѹ߶
  117. */
  118. int32_t yaxian_duoji_move_to_reset();
  119. int32_t yaxian_duoji_move_to_press_pos();
  120. int32_t yaxian_duoji_move_to_wait_for_press_pos();
  121. /**
  122. * @brief
  123. */
  124. int32_t xianlajin_duoji_move_to_reset(); // ��λ
  125. int32_t xianlajin_duoji_move_to_line_entry_pos(); // ����λ
  126. int32_t xianlajin_duoji_move_to_tight_line_pos(); // �����
  127. int32_t xianlajin_duoji_move_to_loose_line_pos(); // �����
  128. /**
  129. * @brief ߶
  130. */
  131. int32_t jiaxian_duoji_move_to_reset_pos();
  132. int32_t jiaxian_duoji_move_to_clamp_pos();
  133. /**
  134. * @brief
  135. */
  136. int32_t scissors_move_reset_pos(); // block
  137. int32_t scissors_cut(); // block
  138. /**
  139. * @brief еۼ߶
  140. */
  141. int32_t arm_jiaxian_duoji_move_to_reset_pos();
  142. int32_t arm_jiaxian_duoji_move_to_clamp_pos();
  143. /**
  144. * @brief е۹צ
  145. */
  146. int32_t arm_hook_claws_reset();
  147. int32_t arm_hook_claws_move_to_half_pos();
  148. int32_t arm_hook_claws_move_to_full_pos();
  149. int32_t main_shaft_run();
  150. int32_t main_shaft_stop();
  151. /**
  152. * @brief XYƽ̨
  153. */
  154. int32_t xy_platform_reset();
  155. /**
  156. * @brief Z
  157. */
  158. int32_t z_axis_reset();
  159. int32_t z_axis_move_to(int32_t pos);
  160. int32_t xy_move_to_zero(); // �ƶ�����λ
  161. int32_t xy_take_clip(int32_t index); // ȡ����
  162. int32_t xy_take_line(); // ȡ��
  163. int32_t xy_take_back_clip(); // �ŵ���
  164. int32_t xy_remove_line(); // �Ƴ���
  165. /**
  166. * @brief
  167. */
  168. int32_t start_winding();
  169. int32_t stop_winding();
  170. int32_t reset_and_check_device();
  171. int32_t setcfg(const char* cfgname, int32_t cfgvalue);
  172. int32_t dumpcfg();
  173. int32_t do_reset_device();
  174. int32_t do_winding(int32_t index);
  175. void processError(int32_t err);
  176. void wait_module_idle(int32_t moduleid);
  177. };
  178. } // namespace iflytop