From ef501ad2cf162e3bd21a6e44492f5c9d25f5b4c8 Mon Sep 17 00:00:00 2001 From: zhaohe Date: Mon, 23 Oct 2023 18:42:40 +0800 Subject: [PATCH] update --- sdk | 2 +- usrc/main.cpp | 9 +++++++-- usrc/script_reg.cpp | 23 ++++++++++++++++++++--- 3 files changed, 28 insertions(+), 6 deletions(-) diff --git a/sdk b/sdk index c31beef..92d3a87 160000 --- a/sdk +++ b/sdk @@ -1 +1 @@ -Subproject commit c31beefe2b25c62beb4e5d17f85710cc7214850e +Subproject commit 92d3a87b81b8e5ccf0e7d7c9cdf25987f8993ce0 diff --git a/usrc/main.cpp b/usrc/main.cpp index 4670a53..adea406 100644 --- a/usrc/main.cpp +++ b/usrc/main.cpp @@ -211,6 +211,13 @@ void Main::run() { *******************************************************************************/ g_main_servo_motor.init(2, &g_modbusblockhost, 1); g_xyrobotctrlmodule.initialize(3, &m_zcanCommnaderMaster); + g_xyrobotctrlmodule.module_set_param(kcfg_motor_x_one_circle_pulse, 7344); + g_xyrobotctrlmodule.module_set_param(kcfg_motor_y_one_circle_pulse, 7344); + g_xyrobotctrlmodule.module_set_param(kcfg_motor_run_to_zero_speed, 50); + g_xyrobotctrlmodule.module_set_param(kcfg_motor_run_to_zero_dec, 1600); + g_xyrobotctrlmodule.module_set_param(kcfg_motor_look_zero_edge_speed, 10); + g_xyrobotctrlmodule.module_set_param(kcfg_motor_look_zero_edge_dec, 1600); + g_xyrobotctrlmodule.module_active_cfg(); g_z_step_motor.initialize(4, &m_zcanCommnaderMaster); g_mini_servo[0].initialize(11, &g_feiteservomotor_bus, 1); @@ -260,8 +267,6 @@ void Main::run() { g_mini_servo_motor_script_cmder.regmodule(4, &g_mini_servo[3]); g_mini_servo_motor_script_cmder.regmodule(5, &g_mini_servo[4]); g_mini_servo_motor_script_cmder.regmodule(6, &g_mini_servo[5]); - - g_taojingchi_screen_service.initialize( &huart5, 1, diff --git a/usrc/script_reg.cpp b/usrc/script_reg.cpp index 9dfb528..2c74841 100644 --- a/usrc/script_reg.cpp +++ b/usrc/script_reg.cpp @@ -163,7 +163,26 @@ void script_reg_fn() { }); #endif - g_cmdScheduler.regCMD("xy_robot_ctrl_get_base_param", "(id)", 1, [](int32_t paramN, const char** paraV, ICmdParserACK* ack) { g_zmodule_device_script_cmder_paser.do_dumpconfig(paramN, paraV, ack); }); + // + + g_cmdScheduler.regCMD("xy_robot_ctrl_read_status", "(id)", 1, [](int32_t paramN, const char** paraV, ICmdParserACK* ack) { + int32_t x; + int32_t y; + int32_t errocode; + int32_t status; + + g_zmodule_device_manager.xymotor_read_pos(XY_ROBOT_ID, &x, &y); + g_zmodule_device_manager.module_get_error(XY_ROBOT_ID, &errocode); + g_zmodule_device_manager.module_get_status(XY_ROBOT_ID, &status); + + ZLOGI(TAG, "x,y:%d,%d", x, y); + ZLOGI(TAG, "errocode:%d", errocode); + ZLOGI(TAG, "status:%d", status); + + g_zmodule_device_script_cmder_paser.do_dumpstate(XY_ROBOT_ID); + }); + + g_cmdScheduler.regCMD("xy_robot_ctrl_get_base_param", "(id)", 1, [](int32_t paramN, const char** paraV, ICmdParserACK* ack) { g_zmodule_device_script_cmder_paser.do_dumpconfig(XY_ROBOT_ID); }); g_cmdScheduler.regCMD("xy_robot_ctrl_move_by", "(id,dx,dy,v)", 4, [](int32_t paramN, const char** paraV, ICmdParserACK* ack) { int32_t dx = atoi(paraV[1]); @@ -264,8 +283,6 @@ void script_reg_fn() { g_zmodule_device_manager.module_get_status(4, &status); ZLOGI(TAG, "pos:%d,errocode:%d,status:%d", pos, errocode, status); - - }); // g_cmdScheduler.regCMD("step_motor_ctrl_rotate", "(id,speed,lastforms)", 3, [](int32_t paramN, const char** paraV, ICmdParserACK* ack) {