diff --git a/usrc/intelligent_winding_robot_ctrl.cpp b/usrc/intelligent_winding_robot_ctrl.cpp index 8d31e6c..062734a 100644 --- a/usrc/intelligent_winding_robot_ctrl.cpp +++ b/usrc/intelligent_winding_robot_ctrl.cpp @@ -1,4 +1,5 @@ #include "intelligent_winding_robot_ctrl.hpp" +#include "sdk\components\zprotocols\zcancmder_v2\protocol_proxy.hpp" #include #include @@ -20,6 +21,11 @@ using namespace iflytop; #define PARAM int32_t paramN, const char **paraV, ICmdParserACK *ack +namespace iflytop { + extern ZIProtocolProxy g_xyrobotctrlmodule; + extern ZIProtocolProxy g_z_step_motor; +} + void IntelligentWindingRobotCtrl::processError(int32_t err) { ZLOGE(TAG, "processError: %d", err); } class myexception : public exception { @@ -167,7 +173,7 @@ class WidthDetector { start_run_back(); } // ZLOGI(TAG, "%d",getDetectGPIOState()); - zos_delay(1); + zos_delay(3); } } else { while (!m_detect_thread.getExitFlag()) { @@ -180,7 +186,7 @@ class WidthDetector { } else if (!g_isrunning && getDetectGPIOState() == 0) { start_run_forward_slow(); } - zos_delay(1); + zos_delay(3); } } }); @@ -392,6 +398,27 @@ int32_t IntelligentWindingRobotCtrl::enable_all_module() { { wait_modules_idle(NULL, __VA_ARGS__, NULL); } int32_t IntelligentWindingRobotCtrl::device_reset() { + + g_xyrobotctrlmodule.module_set_param(kcfg_motor_x_shift, 0); + g_xyrobotctrlmodule.module_set_param(kcfg_motor_y_shift, 0); + 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, 80); + 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_set_param(kcfg_motor_default_velocity, 600); + g_xyrobotctrlmodule.module_set_param(kcfg_motor_default_acc, 1000); + g_xyrobotctrlmodule.module_set_param(kcfg_motor_default_dec, 1000); + g_xyrobotctrlmodule.module_set_param(k_cfg_stepmotor_irun, 4); + + g_xyrobotctrlmodule.module_active_cfg(); + + g_z_step_motor.module_set_param(kcfg_motor_x_shift, 0); + g_z_step_motor.module_set_param(kcfg_motor_x_one_circle_pulse, 800); + g_z_step_motor.module_active_cfg(); + + // ZÖḴλ /** * @ @@ -980,6 +1007,8 @@ int32_t IntelligentWindingRobotCtrl::setcfg(const char* cfgname, int32_t cfgvalu int32_t IntelligentWindingRobotCtrl::dumpcfg() { return 0; } int32_t IntelligentWindingRobotCtrl::start_winding() { // + + #if 0 m_work_thread.start([this]() { try {