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

484 lines
20 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
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
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. #include "main.hpp"
  2. #include <stddef.h>
  3. #include <stdio.h>
  4. //
  5. #include "feite_servo_motor.hpp"
  6. #include "sdk/os/zos.hpp"
  7. //
  8. // #include "sdk\components\cmdscheduler\cmd_scheduler.hpp"
  9. #include "sdk\components\eq_20_asb_motor\eq20_servomotor.hpp"
  10. #include "sdk\components\iflytop_can_slave_module_master_end\stepmotor.hpp"
  11. #include "sdk\components\iflytop_can_slave_v1\iflytop_can_master.hpp"
  12. #include "sdk\components\step_motor_45\step_motor_45.hpp"
  13. #include "sdk\components\step_motor_45\step_motor_45_scheduler.hpp"
  14. #include "sdk\components\zcancmder\zcanreceiver_master.hpp"
  15. //
  16. #include "sdk\components/step_motor_ctrl_module/step_motor_ctrl_script_cmder_module.hpp"
  17. #include "sdk\components/xy_robot_ctrl_module/xy_robot_script_cmder_module.hpp"
  18. #include "sdk\components\cmdscheduler\cmd_scheduler_v2.hpp"
  19. #include "sdk\components\eq_20_asb_motor\script_cmder_eq20_servomotor.hpp"
  20. #include "sdk\components\mini_servo_motor\mini_servo_motor_ctrl_module.hpp"
  21. #include "sdk\components\mini_servo_motor\scirpt_cmder_mini_servo_motor_ctrl_module.hpp"
  22. #include "sdk\components\step_motor_45\script_cmder_step_motor_45.hpp"
  23. // #include "sdk\components\scriptcmder_module\xy_robot_script_cmder_module.hpp"
  24. // #include "sdk\components\zcancmder_master_module/zcan_master_step_motor_ctrl_module.hpp"
  25. // #include "sdk\components\zcancmder_master_module\zcan_xy_robot_master_module.hpp"
  26. #include "intelligent_winding_robot_ctrl.hpp"
  27. #include "sdk\components\taojingchi_screen\taojingchi_screen_service.hpp"
  28. #include "sdk\components\zprotocol_helper\micro_computer_module_device_script_cmder_paser.hpp"
  29. #include "sdk\components\zprotocols\zcancmder_v2\protocol_proxy.hpp"
  30. #include "sdk\components\zprotocols\zcancmder_v2\zmodule_device_manager.hpp"
  31. #include "sdk\components\zprotocols\zcancmder_v2\zmodule_device_script_cmder_paser.hpp"
  32. #define TAG "main"
  33. namespace iflytop {
  34. Main gmain;
  35. };
  36. using namespace iflytop;
  37. using namespace std;
  38. #define CHECK_ARGC(n) \
  39. if (argc != (n + 1)) { \
  40. ZLOGE(TAG, "argc != %d", n); \
  41. context->breakflag = true; \
  42. return; \
  43. }
  44. extern "C" {
  45. void StartDefaultTask(void const* argument) { iflytop::gmain.run(); }
  46. }
  47. /*******************************************************************************
  48. * *
  49. *******************************************************************************/
  50. static chip_cfg_t chipcfg = {
  51. .us_dleay_tim = &DELAY_US_TIMER,
  52. .tim_irq_scheduler_tim = &TIM_IRQ_SCHEDULER_TIMER,
  53. .huart = &DEBUG_UART,
  54. .debuglight = DEBUG_LIGHT_GPIO,
  55. };
  56. static StepMotor45::cfg_t cfg1 = {
  57. .max_pos = -1,
  58. .enable_zero_limit = true,
  59. .enable_max_pos_limit = false,
  60. .mirror = true,
  61. .zeroPin = PB13,
  62. .ioPollType = ZGPIO::kMode_pullup,
  63. .zeroPinMirror = true,
  64. .driverPin = {PB15, PD11, PD12, PD13},
  65. .driverPinMirror = true,
  66. };
  67. static StepMotor45::cfg_t cfg2 = {
  68. .max_pos = -1,
  69. .enable_zero_limit = true,
  70. .enable_max_pos_limit = false,
  71. .mirror = true,
  72. .zeroPin = PG1,
  73. .ioPollType = ZGPIO::kMode_pullup,
  74. .zeroPinMirror = true,
  75. .driverPin = {PG2, PG3, PG4, PG5},
  76. .driverPinMirror = true,
  77. };
  78. static StepMotor45::cfg_t cfg3 = {
  79. .max_pos = -1,
  80. .enable_zero_limit = true,
  81. .enable_max_pos_limit = false,
  82. .mirror = true,
  83. .zeroPin = PB12,
  84. .ioPollType = ZGPIO::kMode_pullup,
  85. .zeroPinMirror = true,
  86. .driverPin = {PG6, PG7, PG8, PC6},
  87. .driverPinMirror = true,
  88. };
  89. #if 0
  90. static StepMotor45::cfg_t cfg4 = {
  91. .max_pos = -1,
  92. .enable_zero_limit = false,
  93. .enable_max_pos_limit = false,
  94. .mirror = true,
  95. .zeroPin = PinNull,
  96. .zeroPinMirror = false,
  97. .driverPin = {PE0, PE2, PE4, PE6},
  98. .driverPinMirror = true,
  99. };
  100. static StepMotor45::cfg_t cfg5 = {
  101. .max_pos = -1,
  102. .enable_zero_limit = false,
  103. .enable_max_pos_limit = false,
  104. .mirror = true,
  105. .zeroPin = PinNull,
  106. .zeroPinMirror = false,
  107. .driverPin = {PC13, PE5, PE3, PE1},
  108. .driverPinMirror = true,
  109. };
  110. static StepMotor45::cfg_t cfg6 = {
  111. .max_pos = -1,
  112. .enable_zero_limit = false,
  113. .enable_max_pos_limit = false,
  114. .mirror = true,
  115. .zeroPin = PinNull,
  116. .zeroPinMirror = false,
  117. .driverPin = {PC12, PD3, PD5, PD7},
  118. .driverPinMirror = true,
  119. };
  120. #endif
  121. namespace iflytop {
  122. /*******************************************************************************
  123. * *
  124. *******************************************************************************/
  125. ZCanCommnaderMaster m_zcanCommnaderMaster; // can����
  126. ModbusBlockHost g_modbusblockhost; // modbus����
  127. FeiTeServoMotor g_feiteservomotor_bus; // ���ض�������
  128. ZModuleDeviceManager g_zmodule_device_manager; // ���ڹ������е��豸
  129. StepMotor45Scheduler step_motor45_scheduler; // 45��������������
  130. CmdSchedulerV2 g_cmdScheduler; // �����ַ���ָ������
  131. TaoJingChiScreenService g_taojingchi_screen_service; // �Ծ�����Ļ����
  132. MicroComputerModuleDeviceScriptCmderPaser g_zmodule_device_script_cmder_paser; // ���ڽ������е��豸ָ��
  133. /*******************************************************************************
  134. * *
  135. *******************************************************************************/
  136. Eq20ServoMotor g_main_servo_motor;
  137. StepMotor45 g_step_motor45[7];
  138. MiniRobotCtrlModule g_mini_servo[6];
  139. /*******************************************************************************
  140. * CAN *
  141. *******************************************************************************/
  142. ZIProtocolProxy g_xyrobotctrlmodule;
  143. ZIProtocolProxy g_z_step_motor;
  144. IntelligentWindingRobotCtrl g_intelligent_winding_robot_ctrl;
  145. } // namespace iflytop
  146. extern "C" {
  147. extern DMA_HandleTypeDef hdma_usart3_rx;
  148. extern DMA_HandleTypeDef hdma_usart3_tx;
  149. }
  150. extern "C" {}
  151. extern DMA_HandleTypeDef hdma_usart2_rx;
  152. extern DMA_HandleTypeDef hdma_usart2_tx;
  153. void regfn() {
  154. #if 0
  155. eq20_enable (id,en)
  156. eq20_get_io_state (id)
  157. eq20_get_pos (id)
  158. eq20_get_servo_internal_state (id)
  159. eq20_move_by (id,pos,rpm,acctime)
  160. eq20_move_to (id,pos,rpm,acctime)
  161. eq20_move_to_zero_backward (id,lookzeropoint_rpm,findzero_edge_rpm,lookzeropoint_acc_time)
  162. eq20_move_to_zero_forward (id,lookzeropoint_rpm,findzero_edge_rpm,lookzeropoint_acc_time)
  163. eq20_rotate (id,rpm,acctime)
  164. eq20_stop (id)
  165. mini_servo_enable (id,en)
  166. mini_servo_move_backward (id,torque)
  167. mini_servo_move_by (id,pos,speed,torque)
  168. mini_servo_move_forward (id,torque)
  169. mini_servo_move_to (id,pos,speed,torque)
  170. mini_servo_position_calibrate (id,pos)
  171. mini_servo_read_status (id)
  172. mini_servo_rotate (id,speed,torque,time)
  173. mini_servo_stop (id,stop_type)
  174. #endif
  175. g_cmdScheduler.regCMD("eq20_enable", "(id,en)", 2, [](int32_t paramN, const char** paraV, ICmdParserACK* ack) {
  176. int32_t en = atoi(paraV[1]);
  177. int32_t ecode = g_zmodule_device_manager.motor_enable(2, en);
  178. ack->setNoneAck(ecode);
  179. });
  180. g_cmdScheduler.regCMD("eq20_get_io_state", "(id)", 1, [](int32_t paramN, const char** paraV, ICmdParserACK* ack) {
  181. int32_t en = atoi(paraV[1]);
  182. int32_t iostate = 0;
  183. int32_t ecode = g_zmodule_device_manager.module_readio(2, &iostate);
  184. ack->setInt32Ack(ecode, iostate);
  185. });
  186. g_cmdScheduler.regCMD("eq20_get_pos", "(id)", 1, [](int32_t paramN, const char** paraV, ICmdParserACK* ack) {
  187. int32_t pos = 0;
  188. int32_t ecode = g_zmodule_device_manager.motor_read_pos(2, &pos);
  189. ack->setInt32Ack(ecode, pos);
  190. });
  191. g_cmdScheduler.regCMD("eq20_get_servo_internal_state", "(id)", 1, [](int32_t paramN, const char** paraV, ICmdParserACK* ack) {
  192. int32_t pos = 0;
  193. int32_t ecode = g_zmodule_device_manager.motor_read_pos(2, &pos);
  194. ack->setInt32Ack(ecode, pos);
  195. });
  196. g_cmdScheduler.regCMD("eq20_move_by", "(id,pos,rpm,acctime)", 4, [](int32_t paramN, const char** paraV, ICmdParserACK* ack) {
  197. int32_t pos = atoi(paraV[1]);
  198. int32_t rpm = atoi(paraV[2]);
  199. int32_t acctime = atoi(paraV[3]);
  200. int32_t ecode = g_zmodule_device_manager.motor_move_by_acctime(2, pos, rpm, acctime);
  201. ack->setNoneAck(ecode);
  202. });
  203. g_cmdScheduler.regCMD("eq20_move_to", "(id,pos,rpm,acctime)", 4, [](int32_t paramN, const char** paraV, ICmdParserACK* ack) {
  204. int32_t pos = atoi(paraV[1]);
  205. int32_t rpm = atoi(paraV[2]);
  206. int32_t acctime = atoi(paraV[3]);
  207. int32_t ecode = g_zmodule_device_manager.motor_move_to_acctime(2, pos, rpm, acctime);
  208. ack->setNoneAck(ecode);
  209. });
  210. g_cmdScheduler.regCMD("eq20_move_to_zero_backward", "(id,lookzeropoint_rpm,findzero_edge_rpm,lookzeropoint_acc_time)", 4, [](int32_t paramN, const char** paraV, ICmdParserACK* ack) {
  211. int32_t lookzeropoint_rpm = atoi(paraV[1]);
  212. int32_t findzero_edge_rpm = atoi(paraV[2]);
  213. int32_t lookzeropoint_acc_time = atoi(paraV[3]);
  214. int32_t ecode = g_zmodule_device_manager.motor_move_to_zero_backward(2, lookzeropoint_rpm, findzero_edge_rpm, 0, 0);
  215. ack->setNoneAck(ecode);
  216. });
  217. g_cmdScheduler.regCMD("eq20_move_to_zero_forward", "(id,lookzeropoint_rpm,findzero_edge_rpm,lookzeropoint_acc_time)", 4, [](int32_t paramN, const char** paraV, ICmdParserACK* ack) {
  218. int32_t lookzeropoint_rpm = atoi(paraV[1]);
  219. int32_t findzero_edge_rpm = atoi(paraV[2]);
  220. int32_t lookzeropoint_acc_time = atoi(paraV[3]);
  221. int32_t ecode = g_zmodule_device_manager.motor_move_to_zero_forward(2, lookzeropoint_rpm, findzero_edge_rpm, 0, 0);
  222. ack->setNoneAck(ecode);
  223. });
  224. g_cmdScheduler.regCMD("eq20_rotate", "(id,rpm,acctime)", 3, [](int32_t paramN, const char** paraV, ICmdParserACK* ack) {
  225. int32_t rpm = atoi(paraV[1]);
  226. int32_t acctime = atoi(paraV[2]);
  227. int32_t absrpm = abs(rpm);
  228. int32_t direction = rpm > 0 ? 1 : -1;
  229. int32_t ecode = g_zmodule_device_manager.motor_rotate_acctime(2, direction, absrpm, acctime);
  230. ack->setNoneAck(ecode);
  231. });
  232. g_cmdScheduler.regCMD("eq20_stop", "(id)", 1, [](int32_t paramN, const char** paraV, ICmdParserACK* ack) {
  233. int32_t ecode = g_zmodule_device_manager.module_stop(2);
  234. ack->setNoneAck(ecode);
  235. });
  236. g_cmdScheduler.regCMD("mini_servo_enable", "(id,en)", 2, [](int32_t paramN, const char** paraV, ICmdParserACK* ack) {
  237. int32_t id = atoi(paraV[0]);
  238. int32_t en = atoi(paraV[1]);
  239. int32_t ecode = g_zmodule_device_manager.motor_enable(id + 10, en);
  240. ack->setNoneAck(ecode);
  241. });
  242. g_cmdScheduler.regCMD("mini_servo_move_backward", "(id,torque)", 2, [](int32_t paramN, const char** paraV, ICmdParserACK* ack) {
  243. int32_t id = atoi(paraV[0]);
  244. int32_t torque = atoi(paraV[1]);
  245. torque = abs(torque);
  246. int32_t ecode = g_zmodule_device_manager.motor_move_to_with_torque(id + 10, 0, torque);
  247. ack->setNoneAck(ecode);
  248. });
  249. g_cmdScheduler.regCMD("mini_servo_move_by", "(id,pos,speed,torque)", 4, [](int32_t paramN, const char** paraV, ICmdParserACK* ack) {
  250. int32_t id = atoi(paraV[0]);
  251. int32_t pos = atoi(paraV[1]);
  252. int32_t speed = atoi(paraV[2]);
  253. int32_t torque = atoi(paraV[3]);
  254. int32_t ecode = g_zmodule_device_manager.motor_move_by(id + 10, pos, speed, 0);
  255. ack->setNoneAck(ecode);
  256. });
  257. g_cmdScheduler.regCMD("mini_servo_move_forward", "(id,torque)", 2, [](int32_t paramN, const char** paraV, ICmdParserACK* ack) {
  258. int32_t id = atoi(paraV[0]);
  259. int32_t torque = atoi(paraV[1]);
  260. torque = abs(torque);
  261. int32_t ecode = g_zmodule_device_manager.motor_move_to_with_torque(id + 10, 0, torque);
  262. ack->setNoneAck(ecode);
  263. });
  264. g_cmdScheduler.regCMD("mini_servo_move_to", "(id,pos,speed,torque)", 4, [](int32_t paramN, const char** paraV, ICmdParserACK* ack) {
  265. int32_t id = atoi(paraV[0]);
  266. int32_t pos = atoi(paraV[1]);
  267. int32_t speed = atoi(paraV[2]);
  268. int32_t torque = atoi(paraV[3]);
  269. int32_t ecode = g_zmodule_device_manager.motor_move_to(id + 10, pos, speed, 0);
  270. ack->setNoneAck(ecode);
  271. });
  272. g_cmdScheduler.regCMD("mini_servo_position_calibrate", "(id,pos)", 2, [](int32_t paramN, const char** paraV, ICmdParserACK* ack) {
  273. int32_t id = atoi(paraV[0]);
  274. int32_t pos = atoi(paraV[1]);
  275. int32_t ecode = g_zmodule_device_manager.motor_set_current_pos_by_change_shift(id + 10, pos);
  276. ack->setNoneAck(ecode);
  277. });
  278. g_cmdScheduler.regCMD("mini_servo_read_status", "(id)", 1, [](int32_t paramN, const char** paraV, ICmdParserACK* ack) {
  279. int32_t id = atoi(paraV[0]);
  280. int32_t pos = 0;
  281. int32_t ecode = g_zmodule_device_manager.motor_read_pos(id + 10, &pos);
  282. ack->setInt32Ack(ecode, pos);
  283. });
  284. g_cmdScheduler.regCMD("mini_servo_rotate", "(id,speed,torque,time)", 4, [](int32_t paramN, const char** paraV, ICmdParserACK* ack) {
  285. int32_t id = atoi(paraV[0]);
  286. int32_t speed = atoi(paraV[1]);
  287. int32_t torque = atoi(paraV[2]);
  288. int32_t time = atoi(paraV[3]);
  289. int direction = speed > 0 ? 1 : -1;
  290. int32_t ecode = g_zmodule_device_manager.motor_rotate(id + 10, direction, speed, time);
  291. ack->setNoneAck(ecode);
  292. });
  293. g_cmdScheduler.regCMD("mini_servo_stop", "(id,stop_type)", 2, [](int32_t paramN, const char** paraV, ICmdParserACK* ack) {
  294. int32_t id = atoi(paraV[0]);
  295. int32_t stop_type = atoi(paraV[1]);
  296. int32_t ecode = g_zmodule_device_manager.module_stop(id + 10);
  297. ack->setNoneAck(ecode);
  298. });
  299. #if 0
  300. step_motor_45_get_pos (id)
  301. step_motor_45_move_by (id,pos)
  302. step_motor_45_move_to (id,pos)
  303. step_motor_45_rotate (id,direction)
  304. step_motor_45_stop (id)
  305. step_motor_45_zero_calibration (id)
  306. #endif
  307. g_cmdScheduler.regCMD("step_motor_45_get_pos", "(id)", 1, [](int32_t paramN, const char** paraV, ICmdParserACK* ack) {
  308. int32_t pos = 0;
  309. int id = atoi(paraV[0]);
  310. int32_t ecode = g_zmodule_device_manager.motor_read_pos(id + 20, &pos);
  311. ack->setInt32Ack(ecode, pos);
  312. });
  313. g_cmdScheduler.regCMD("step_motor_45_move_by", "(id,pos)", 2, [](int32_t paramN, const char** paraV, ICmdParserACK* ack) {
  314. int32_t pos = atoi(paraV[1]);
  315. int id = atoi(paraV[0]);
  316. int32_t ecode = g_zmodule_device_manager.motor_move_by(id + 20, pos,0,0);
  317. ack->setNoneAck(ecode);
  318. });
  319. g_cmdScheduler.regCMD("step_motor_45_move_to", "(id,pos)", 2, [](int32_t paramN, const char** paraV, ICmdParserACK* ack) {
  320. int32_t pos = atoi(paraV[1]);
  321. int id = atoi(paraV[0]);
  322. int32_t ecode = g_zmodule_device_manager.motor_move_to(id + 20, pos,0,0);
  323. ack->setNoneAck(ecode);
  324. });
  325. g_cmdScheduler.regCMD("step_motor_45_rotate", "(id,direction)", 2, [](int32_t paramN, const char** paraV, ICmdParserACK* ack) {
  326. int32_t direction = atoi(paraV[1]);
  327. int id = atoi(paraV[0]);
  328. int32_t ecode = g_zmodule_device_manager.motor_rotate(id + 20, direction,0,0);
  329. ack->setNoneAck(ecode);
  330. });
  331. g_cmdScheduler.regCMD("step_motor_45_stop", "(id)", 1, [](int32_t paramN, const char** paraV, ICmdParserACK* ack) {
  332. int id = atoi(paraV[0]);
  333. int32_t ecode = g_zmodule_device_manager.module_stop(id + 20);
  334. ack->setNoneAck(ecode);
  335. });
  336. g_cmdScheduler.regCMD("step_motor_45_zero_calibration", "(id)", 1, [](int32_t paramN, const char** paraV, ICmdParserACK* ack) {
  337. int id = atoi(paraV[0]);
  338. int32_t ecode = g_zmodule_device_manager.motor_move_to_zero_backward(id + 20,0,0,0,0);
  339. ack->setNoneAck(ecode);
  340. });
  341. }
  342. extern void step_motor_cmd_reg();
  343. void Main::run() {
  344. /*******************************************************************************
  345. * ϵͳʼ *
  346. *******************************************************************************/
  347. chip_init(&chipcfg);
  348. zos_cfg_t zoscfg;
  349. zos_init(&zoscfg);
  350. /*******************************************************************************
  351. * ߳ʼ *
  352. *******************************************************************************/
  353. auto* cfg = m_zcanCommnaderMaster.createCFG(); // can��������
  354. m_zcanCommnaderMaster.init(cfg); // can����
  355. g_modbusblockhost.initialize(&huart2, &hdma_usart2_tx, &hdma_usart2_rx); // modbus����
  356. g_feiteservomotor_bus.initialize(&huart3, &hdma_usart3_rx, &hdma_usart3_tx); // ���ض�������
  357. step_motor45_scheduler.initialize(&htim10);
  358. // �豸��������ʼ��
  359. g_zmodule_device_manager.initialize(&m_zcanCommnaderMaster);
  360. // �豸ָ����������ʼ��
  361. /*******************************************************************************
  362. * ͳʼ *
  363. *******************************************************************************/
  364. g_main_servo_motor.init(2, &g_modbusblockhost, 1);
  365. g_xyrobotctrlmodule.initialize(3, &m_zcanCommnaderMaster);
  366. g_z_step_motor.initialize(4, &m_zcanCommnaderMaster);
  367. g_mini_servo[0].initialize(11, &g_feiteservomotor_bus, 1);
  368. g_mini_servo[1].initialize(12, &g_feiteservomotor_bus, 2);
  369. g_mini_servo[2].initialize(13, &g_feiteservomotor_bus, 3);
  370. g_mini_servo[3].initialize(14, &g_feiteservomotor_bus, 4);
  371. g_mini_servo[4].initialize(15, &g_feiteservomotor_bus, 5);
  372. g_mini_servo[5].initialize(16, &g_feiteservomotor_bus, 6);
  373. g_step_motor45[0].initialize(21, &step_motor45_scheduler, cfg1);
  374. g_step_motor45[1].initialize(22, &step_motor45_scheduler, cfg2);
  375. g_step_motor45[2].initialize(23, &step_motor45_scheduler, cfg3);
  376. step_motor45_scheduler.start();
  377. g_zmodule_device_manager.registerModule(&g_main_servo_motor);
  378. g_zmodule_device_manager.registerModule(&g_xyrobotctrlmodule);
  379. g_zmodule_device_manager.registerModule(&g_z_step_motor);
  380. g_zmodule_device_manager.registerModule(&g_mini_servo[0]);
  381. g_zmodule_device_manager.registerModule(&g_mini_servo[1]);
  382. g_zmodule_device_manager.registerModule(&g_mini_servo[2]);
  383. g_zmodule_device_manager.registerModule(&g_mini_servo[3]);
  384. g_zmodule_device_manager.registerModule(&g_mini_servo[4]);
  385. g_zmodule_device_manager.registerModule(&g_mini_servo[5]);
  386. g_zmodule_device_manager.registerModule(&g_step_motor45[0]);
  387. g_zmodule_device_manager.registerModule(&g_step_motor45[1]);
  388. g_zmodule_device_manager.registerModule(&g_step_motor45[2]);
  389. g_intelligent_winding_robot_ctrl.initialize(&g_zmodule_device_manager, &g_cmdScheduler);
  390. /*******************************************************************************
  391. * ַָ *
  392. *******************************************************************************/
  393. g_cmdScheduler.initialize(&DEBUG_UART, 1000); //
  394. g_zmodule_device_script_cmder_paser.initialize(&g_cmdScheduler, &g_zmodule_device_manager);
  395. g_taojingchi_screen_service.initialize(
  396. &huart5, 1,
  397. /**
  398. * @brief ˽Э
  399. */
  400. [this](const char* cmd, int32_t paramN, const char** paraV) { //
  401. ZLOGI(TAG, "process cmd:%s", cmd);
  402. },
  403. /**
  404. * @brief վϢ
  405. */
  406. [this](uint8_t* data, size_t len) {});
  407. regfn();
  408. #if 0
  409. step_motor_cmd_reg();
  410. #endif
  411. while (true) {
  412. OSDefaultSchduler::getInstance()->loop();
  413. g_cmdScheduler.schedule();
  414. osDelay(1);
  415. }
  416. }