Browse Source

update

master
zhaohe 2 years ago
parent
commit
ef501ad2cf
  1. 2
      sdk
  2. 9
      usrc/main.cpp
  3. 23
      usrc/script_reg.cpp

2
sdk

@ -1 +1 @@
Subproject commit c31beefe2b25c62beb4e5d17f85710cc7214850e
Subproject commit 92d3a87b81b8e5ccf0e7d7c9cdf25987f8993ce0

9
usrc/main.cpp

@ -211,6 +211,13 @@ void Main::run() {
*******************************************************************************/ *******************************************************************************/
g_main_servo_motor.init(2, &g_modbusblockhost, 1); g_main_servo_motor.init(2, &g_modbusblockhost, 1);
g_xyrobotctrlmodule.initialize(3, &m_zcanCommnaderMaster); 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_z_step_motor.initialize(4, &m_zcanCommnaderMaster);
g_mini_servo[0].initialize(11, &g_feiteservomotor_bus, 1); 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(4, &g_mini_servo[3]);
g_mini_servo_motor_script_cmder.regmodule(5, &g_mini_servo[4]); 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_mini_servo_motor_script_cmder.regmodule(6, &g_mini_servo[5]);
g_taojingchi_screen_service.initialize( g_taojingchi_screen_service.initialize(
&huart5, 1, &huart5, 1,

23
usrc/script_reg.cpp

@ -163,7 +163,26 @@ void script_reg_fn() {
}); });
#endif #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) { 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]); int32_t dx = atoi(paraV[1]);
@ -264,8 +283,6 @@ void script_reg_fn() {
g_zmodule_device_manager.module_get_status(4, &status); g_zmodule_device_manager.module_get_status(4, &status);
ZLOGI(TAG, "pos:%d,errocode:%d,status:%d", pos, errocode, 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) { // g_cmdScheduler.regCMD("step_motor_ctrl_rotate", "(id,speed,lastforms)", 3, [](int32_t paramN, const char** paraV, ICmdParserACK* ack) {

Loading…
Cancel
Save