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

202 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
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_process_line_high;
  77. int32_t z_axis_take_clip_pos;
  78. int32_t z_axis_winding_hight;
  79. // 3377
  80. int32_t z_axis_cook_bullet_pos;
  81. /**
  82. * @brief XYƽ̨
  83. */
  84. int32_t xy_platform_cook_bullet_pos_x;
  85. int32_t xy_platform_cook_bullet_pos_y;
  86. int32_t xy_platform_remove_line_pos_x;
  87. int32_t xy_platform_remove_line_pos_y;
  88. int32_t xy_platform_takeline_pos_x;
  89. int32_t xy_platform_takeline_pos_y;
  90. int32_t xy_platform_takeline_clip00_pos_x; //
  91. int32_t xy_platform_takeline_clip00_pos_y;
  92. int32_t xy_platform_takeline_clipXX_pos_x;
  93. int32_t xy_platform_takeline_clipXX_pos_y;
  94. int32_t clip_line;
  95. int32_t clip_each_line_num;
  96. } config_t;
  97. APPDM* m_dm;
  98. ICmdParser* m_cmdparse;
  99. config_t cfg;
  100. public:
  101. int32_t initialize(APPDM* dm, ICmdParser* cmdparse);
  102. private:
  103. void start_probe_bullet_pos();
  104. void stop_probe_bullet_pos();
  105. int32_t get_probe_bullet_pos();
  106. bool is_hasbullet();
  107. public:
  108. void wait_module_idle(int32_t moduleid);
  109. void wait_modules_idle(void* mark, ...);
  110. int32_t m11_arm_jiaxian_move_to_reset_pos();
  111. int32_t m11_arm_jiaxian_move_to_clamp_pos();
  112. int32_t m12_jiaxian_move_to_open_pos();
  113. int32_t m12_jiaxian_move_to_clamp_pos();
  114. int32_t m13_yaxian_move_to_reset_forward();
  115. int32_t m13_yaxian_move_to_reset_backward();
  116. int32_t m13_yaxian_press_clip();
  117. int32_t m14_raoxiantance_move_to_reset();
  118. int32_t m15_paifei_moveto_reset();
  119. int32_t m15_paifei_moveto_press();
  120. int32_t m16_xianlajin_move_to_reset();
  121. int32_t m16_xianlajin_move_to_tight_line_pos();
  122. int32_t m16_xianlajin_move_to_winding_low_pos();
  123. int32_t m16_xianlajin_move_to_winding_up_pos();
  124. int32_t m16_xianlajin_move_to_line_entry_pos();
  125. int32_t m21_arm_hook_claws_reset();
  126. int32_t m21_arm_hook_claws_move_to_half_pos();
  127. int32_t m21_arm_hook_claws_move_to_full_pos();
  128. int32_t m22_scissors_move_reset_pos(); // block
  129. int32_t m22_scissors_cut(); // block
  130. int32_t m23_laxian_motor_move_to_reset_pos(); // block
  131. int32_t m23_laxian_motor_move_to_tight_line_pos(); // block
  132. int32_t m4_zreset();
  133. int32_t m4_zmove_to(int32_t pos);
  134. int32_t device_reset();
  135. int32_t disable_all_module();
  136. int32_t enable_all_module();
  137. int32_t step_take_bullet(int32_t bulletindex);
  138. int32_t step_prepare_remove_line();
  139. int32_t step_remove_line();
  140. int32_t xy_get_point(int32_t clip_index, int32_t& x, int32_t& y); // ȡ����
  141. int32_t xy_run_to(int32_t x, int32_t y, int32_t zpos = 0, bool jiaxian_reset = true); // ȡ����
  142. int32_t xy_run_to_clip_pos_test(int32_t clip_index);
  143. int32_t xy_reset();
  144. int32_t xymove_to(int32_t x, int32_t y);
  145. void regcb();
  146. int32_t initialize_device();
  147. int32_t main_shaft_run();
  148. int32_t main_shaft_stop();
  149. /**
  150. * @brief XYƽ̨
  151. */
  152. int32_t xy_platform_reset();
  153. /**
  154. * @brief
  155. */
  156. int32_t start_winding();
  157. int32_t stop_winding();
  158. int32_t reset_and_check_device();
  159. int32_t setcfg(const char* cfgname, int32_t cfgvalue);
  160. int32_t dumpcfg();
  161. int32_t do_reset_device();
  162. int32_t do_winding(int32_t index);
  163. void processError(int32_t err);
  164. };
  165. } // namespace iflytop