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

213 lines
5.4 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
  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. /**
  16. * @brief еۼ߶
  17. */
  18. int32_t m11_arm_jiaxian_reset_pos;
  19. int32_t m11_arm_jiaxian_clamp_direction;
  20. int32_t m11_arm_jiaxian_clamp_torque;
  21. /**
  22. * @brief ߼н
  23. */
  24. int32_t m12_jiaxian_reset_pos;
  25. int32_t m12_jiaxian_clamp_direction;
  26. int32_t m12_jiaxian_clamp_torque;
  27. /**
  28. * @brief ѹ߶
  29. */
  30. /**
  31. * ߶:
  32. * 1. ûе 1015
  33. * 2. е 1055
  34. * 3. п 1110
  35. *
  36. */
  37. int32_t m13_yaxian_forward_reset_pos; // ѹ������λ
  38. int32_t m13_yaxian_backward_reset_pos; // ��������λ
  39. int32_t m13_jiaxian_clamp_direction; // ѹ�߷���
  40. int32_t m13_jiaxian_clamp_torque; // ѹ��Ť��
  41. /**
  42. * @brief ̽
  43. */
  44. int32_t m14_raoxiantance_reset_pos;
  45. int32_t m14_raoxiantance_tance_zero_pos;
  46. /**
  47. * @brief ŷ϶
  48. */
  49. int32_t m15_paifei_reset_pos;
  50. int32_t m15_paifei_press_direction;
  51. int32_t m15_paifei_press_torque;
  52. /**
  53. * @brief
  54. */
  55. int32_t m16_xianlajin_reset_pos;
  56. int32_t m16_xianlajin_tight_line_pos;
  57. int32_t m16_xianlajin_winding_low_pos;
  58. int32_t m16_xianlajin_winding_up_pos;
  59. int32_t m16_xianlajin_line_entry_pos;
  60. /**
  61. * @brief צ
  62. */
  63. int32_t m21_arm_hook_claws_half_pos;
  64. int32_t m21_arm_hook_claws_full_pos;
  65. /**
  66. * @brief
  67. */
  68. // int32_t m22_scissors_cut_pos;
  69. /**
  70. * @brief
  71. */
  72. // int32_t m23_laxian_move_to_tight_pos;
  73. /**
  74. * @brief Zλ
  75. */
  76. int32_t z_axis_take_line_high;
  77. int32_t z_axis_take_clip_pos;
  78. int32_t z_axis_winding_hight;
  79. int32_t z_axis_transfer_line_high;
  80. // 2585
  81. // 3377
  82. int32_t z_axis_cook_bullet_pos;
  83. /**
  84. * @brief XYƽ̨
  85. */
  86. int32_t xy_platform_cook_bullet_pos_x; // ���߼ӹ�
  87. int32_t xy_platform_cook_bullet_pos_y; // ���߼ӹ�
  88. int32_t xy_platform_remove_line_pos_x; // ����λ
  89. int32_t xy_platform_remove_line_pos_y; // ����λ
  90. int32_t xy_platform_takeline_pos_x; // ȡ��λ��
  91. int32_t xy_platform_takeline_pos_y; // ȡ��λ��
  92. int32_t xy_platform_enter_line_pos_x; // ����λ
  93. int32_t xy_platform_enter_line_pos_y; // ����λ
  94. //
  95. int32_t xy_platform_takeline_clip00_pos_x; //
  96. int32_t xy_platform_takeline_clip00_pos_y;
  97. int32_t xy_platform_takeline_clipXX_pos_x;
  98. int32_t xy_platform_takeline_clipXX_pos_y;
  99. int32_t clip_line;
  100. int32_t clip_each_line_num;
  101. } config_t;
  102. APPDM* m_dm;
  103. ICmdParser* m_cmdparse;
  104. config_t cfg;
  105. public:
  106. int32_t initialize(APPDM* dm, ICmdParser* cmdparse);
  107. private:
  108. void start_probe_bullet_pos();
  109. void stop_probe_bullet_pos();
  110. int32_t get_probe_bullet_pos();
  111. bool is_hasbullet();
  112. public:
  113. void wait_module_idle(int32_t moduleid);
  114. void wait_modules_idle(void* mark, ...);
  115. int32_t m11_arm_jiaxian_move_to_reset_pos();
  116. int32_t m11_arm_jiaxian_move_to_clamp_pos();
  117. int32_t m12_jiaxian_move_to_open_pos();
  118. int32_t m12_jiaxian_move_to_clamp_pos();
  119. int32_t m13_yaxian_move_to_reset_forward();
  120. int32_t m13_yaxian_move_to_reset_backward();
  121. int32_t m13_yaxian_press_clip();
  122. int32_t m14_raoxiantance_move_to_reset();
  123. int32_t m15_paifei_moveto_reset();
  124. int32_t m15_paifei_moveto_press();
  125. int32_t m16_xianlajin_move_to_reset();
  126. int32_t m16_xianlajin_move_to_tight_line_pos();
  127. int32_t m16_xianlajin_move_to_winding_low_pos();
  128. int32_t m16_xianlajin_move_to_winding_up_pos();
  129. int32_t m16_xianlajin_move_to_line_entry_pos();
  130. int32_t m21_arm_hook_claws_reset();
  131. int32_t m21_arm_hook_claws_move_to_half_pos();
  132. int32_t m21_arm_hook_claws_move_to_full_pos();
  133. int32_t m22_scissors_move_reset_pos(); // block
  134. int32_t m22_scissors_cut(); // block
  135. int32_t m23_laxian_motor_move_to_reset_pos(); // block
  136. int32_t m23_laxian_motor_move_to_tight_line_pos(); // block
  137. int32_t m4_zreset();
  138. int32_t m4_zmove_to(int32_t pos);
  139. int32_t device_reset();
  140. int32_t disable_all_module();
  141. int32_t enable_all_module();
  142. int32_t step_take_bullet(int32_t bulletindex);
  143. int32_t step_take_back_bullet(int32_t bulletindex);
  144. int32_t step_prepare_remove_line(int32_t bulletindex);
  145. int32_t step_remove_line();
  146. int32_t step_winding_prepare();
  147. int32_t xy_get_point(int32_t clip_index, int32_t& x, int32_t& y); // ȡ����
  148. int32_t xy_run_to(int32_t x, int32_t y, int32_t zpos = 0, bool jiaxian_reset = true); // ȡ����
  149. int32_t xy_run_to_clip_pos_test(int32_t clip_index);
  150. int32_t xy_reset();
  151. int32_t xymove_to(int32_t x, int32_t y);
  152. int32_t xymove_to_bullet_pos(int32_t bulletindex);
  153. void regcb();
  154. int32_t initialize_device();
  155. int32_t main_shaft_run();
  156. int32_t main_shaft_stop();
  157. /**
  158. * @brief XYƽ̨
  159. */
  160. int32_t xy_platform_reset();
  161. /**
  162. * @brief
  163. */
  164. int32_t start_winding();
  165. int32_t stop_winding();
  166. int32_t reset_and_check_device();
  167. int32_t setcfg(const char* cfgname, int32_t cfgvalue);
  168. int32_t dumpcfg();
  169. int32_t do_reset_device();
  170. int32_t do_winding(int32_t index);
  171. void processError(int32_t err);
  172. };
  173. } // namespace iflytop