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

249 lines
6.8 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
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
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. //
  6. #include "app_zmodule_device_manager.hpp"
  7. #define ZMOTOR_ID 4
  8. #define XYRobot_ID 3
  9. #define XYRobot_HOOK_ID 21
  10. namespace iflytop {
  11. using namespace std;
  12. class IntelligentWindingRobotCtrl {
  13. public:
  14. typedef struct {
  15. int32_t m2_zerooff;
  16. /**
  17. * @brief еۼ߶
  18. */
  19. int32_t m11_arm_jiaxian_reset_pos;
  20. int32_t m11_arm_jiaxian_clamp_direction;
  21. int32_t m11_arm_jiaxian_clamp_torque;
  22. /**
  23. * @brief ߼н
  24. */
  25. int32_t m12_jiaxian_reset_pos;
  26. int32_t m12_jiaxian_clamp_direction;
  27. int32_t m12_jiaxian_clamp_torque;
  28. /**
  29. * @brief ѹ߶
  30. */
  31. /**
  32. * ߶:
  33. * 1. ûе 1015
  34. * 2. е 1055
  35. * 3. п 1110
  36. *
  37. */
  38. int32_t m13_yaxian_forward_reset_pos; // ѹ������λ
  39. int32_t m13_yaxian_backward_reset_pos; // ��������λ
  40. int32_t m13_jiaxian_clamp_direction; // ѹ�߷���
  41. int32_t m13_jiaxian_clamp_torque; // ѹ��Ť��
  42. /**
  43. * @brief ̽
  44. */
  45. int32_t m14_raoxiantance_reset_pos;
  46. int32_t m14_raoxiantance_tance_zero_pos;
  47. /**
  48. * @brief ŷ϶
  49. */
  50. int32_t m15_paifei_reset_pos;
  51. int32_t m15_paifei_press_direction;
  52. int32_t m15_paifei_press_torque;
  53. /**
  54. * @brief
  55. */
  56. int32_t m16_xianlajin_reset_pos;
  57. int32_t m16_xianlajin_tight_line_pos;
  58. int32_t m16_xianlajin_winding_low_pos;
  59. int32_t m16_xianlajin_winding_high_pos;
  60. int32_t m16_xianlajin_line_entry_pos;
  61. int32_t m16_xianlajin_cook_line_end_high_pos;
  62. int32_t m16_xianlajin_cook_line_end_low_pos;
  63. /**
  64. * @brief צ
  65. */
  66. int32_t m21_arm_hook_claws_half_pos;
  67. int32_t m21_arm_hook_claws_full_pos;
  68. /**
  69. * @brief
  70. */
  71. // int32_t m22_scissors_cut_pos;
  72. /**
  73. * @brief
  74. */
  75. // int32_t m23_laxian_move_to_tight_pos;
  76. /**
  77. * @brief Zλ
  78. */
  79. int32_t z_axis_take_line_high;
  80. int32_t z_axis_take_clip_pos;
  81. int32_t z_axis_winding_hight;
  82. int32_t z_axis_transfer_line_high;
  83. // 2585
  84. // 3377
  85. int32_t z_axis_cook_bullet_pos;
  86. /**
  87. * @brief XYƽ̨
  88. */
  89. int32_t xy_platform_cook_bullet_pos_x; // ���߼ӹ�
  90. int32_t xy_platform_cook_bullet_pos_y; // ���߼ӹ�
  91. int32_t xy_platform_remove_line_pos_x; // ����λ
  92. int32_t xy_platform_remove_line_pos_y; // ����λ
  93. int32_t xy_platform_takeline_pos_x; // ȡ��λ��
  94. int32_t xy_platform_takeline_pos_y; // ȡ��λ��
  95. int32_t xy_platform_enter_line_pos_x; // ����λ
  96. int32_t xy_platform_enter_line_pos_y; // ����λ
  97. //
  98. int32_t xy_platform_takeline_clip00_pos_x; //
  99. int32_t xy_platform_takeline_clip00_pos_y;
  100. int32_t xy_platform_takeline_clipXX_pos_x;
  101. int32_t xy_platform_takeline_clipXX_pos_y;
  102. int32_t clip_line;
  103. int32_t clip_each_line_num;
  104. } config_t;
  105. APPDM* m_dm;
  106. ICmdParser* m_cmdparse;
  107. config_t cfg;
  108. typedef enum {
  109. kBulletBulletHolderPos = 0,
  110. kCookPos,
  111. } take_bullet_pos_type_t;
  112. typedef enum {
  113. kTakeBullet = 0,
  114. kTakeBackBullet,
  115. kTakeBulletCase,
  116. kTakeBackBulletCase,
  117. } take_bullet_acktion_t;
  118. typedef enum {
  119. kTakeLine = 0,
  120. kReleaseLine,
  121. kKeepLine,
  122. } take_bullet_line_acktion_t;
  123. public:
  124. int32_t initialize(APPDM* dm, ICmdParser* cmdparse);
  125. private:
  126. void start_probe_bullet_pos();
  127. void stop_probe_bullet_pos();
  128. int32_t get_probe_bullet_pos();
  129. bool is_hasbullet();
  130. public:
  131. void wait_module_idle(int32_t moduleid);
  132. void wait_modules_idle(void* mark, ...);
  133. int32_t m11_arm_jiaxian_move_to_reset_pos();
  134. int32_t m11_arm_jiaxian_move_to_clamp_pos();
  135. int32_t m12_jiaxian_move_to_open_pos();
  136. int32_t m12_jiaxian_move_to_clamp_pos();
  137. int32_t m13_yaxian_move_to_reset_forward();
  138. int32_t m13_yaxian_move_to_reset_backward();
  139. int32_t m13_yaxian_press_clip();
  140. int32_t m14_raoxiantance_move_to_reset();
  141. int32_t m15_paifei_moveto_reset();
  142. int32_t m15_paifei_moveto_press();
  143. int32_t m16_xianlajin_move_to_reset();
  144. int32_t m16_xianlajin_move_to_tight_line_pos();
  145. int32_t m16_xianlajin_move_to_winding_low_pos();
  146. int32_t m16_xianlajin_move_to_winding_up_pos();
  147. int32_t m16_xianlajin_move_to_line_entry_pos();
  148. int32_t m16_xianlajin_move_to_cook_lineend_high_pos();
  149. int32_t m16_xianlajin_move_to_cook_lineend_low_pos();
  150. int32_t m21_arm_hook_claws_reset();
  151. int32_t m21_arm_hook_claws_move_to_half_pos();
  152. int32_t m21_arm_hook_claws_move_to_full_pos();
  153. int32_t m22_scissors_move_reset_pos(); //
  154. int32_t m22_scissors_cut(); //
  155. int32_t m23_laxian_motor_move_to_reset_pos(); //
  156. int32_t m23_laxian_motor_move_to_tight_line_pos(); //
  157. int32_t m4_zreset();
  158. int32_t m4_zmove_to(int32_t pos);
  159. int32_t device_reset();
  160. int32_t disable_all_module();
  161. int32_t enable_all_module();
  162. int32_t substep_zaxis_do_bullet_action(take_bullet_pos_type_t zpos, //
  163. take_bullet_acktion_t take_bullet_acktion, //
  164. take_bullet_line_acktion_t take_bullet_line_acktion, //
  165. function<void()> bottomoperation = nullptr);
  166. int32_t step_take_bullet(int32_t bulletindex);
  167. int32_t step_take_back_bullet(int32_t bulletindex);
  168. int32_t step_take_bullet_case(int32_t bulletindex);
  169. int32_t step_take_back_bullet_case(int32_t bulletindex);
  170. int32_t step_prepare_remove_line(int32_t bulletindex);
  171. int32_t step_remove_line();
  172. int32_t step_winding_prepare();
  173. int32_t step_winding();
  174. // int32_t step_load_the_bullet_case();
  175. int32_t step_winding_lineend_prepare(int bulletindex); // ����ͷ׼��
  176. int32_t step_winding_lineend(); // ����ͷ
  177. int32_t step_winding_take_bullet_from_cooking_to_origin_pos(int bulletindex); // ����ͷ
  178. int32_t xy_get_point(int32_t clip_index, int32_t& x, int32_t& y); // ȡ����
  179. int32_t xy_run_to(int32_t x, int32_t y, int32_t zpos = 0, bool jiaxian_reset = true); // ȡ����
  180. int32_t xy_run_to_clip_pos_test(int32_t clip_index);
  181. int32_t xy_reset();
  182. int32_t xymove_to(int32_t x, int32_t y);
  183. int32_t xymove_to_bullet_pos(int32_t bulletindex);
  184. void regcb();
  185. int32_t initialize_device();
  186. int32_t main_shaft_run();
  187. int32_t main_shaft_stop();
  188. /**
  189. * @brief XYƽ̨
  190. */
  191. int32_t xy_platform_reset();
  192. /**
  193. * @brief
  194. */
  195. int32_t start_winding();
  196. int32_t stop_winding();
  197. int32_t reset_and_check_device();
  198. int32_t setcfg(const char* cfgname, int32_t cfgvalue);
  199. int32_t dumpcfg();
  200. int32_t do_reset_device();
  201. int32_t do_winding(int32_t index);
  202. void processError(int32_t err);
  203. };
  204. } // namespace iflytop