Browse Source

update

master
zhaohe 2 years ago
parent
commit
297eaefb0f
  1. 33
      usrc/intelligent_winding_robot_ctrl.cpp

33
usrc/intelligent_winding_robot_ctrl.cpp

@ -1,4 +1,5 @@
#include "intelligent_winding_robot_ctrl.hpp" #include "intelligent_winding_robot_ctrl.hpp"
#include "sdk\components\zprotocols\zcancmder_v2\protocol_proxy.hpp"
#include <stdarg.h> #include <stdarg.h>
#include <stdlib.h> #include <stdlib.h>
@ -20,6 +21,11 @@ using namespace iflytop;
#define PARAM int32_t paramN, const char **paraV, ICmdParserACK *ack #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); } void IntelligentWindingRobotCtrl::processError(int32_t err) { ZLOGE(TAG, "processError: %d", err); }
class myexception : public exception { class myexception : public exception {
@ -167,7 +173,7 @@ class WidthDetector {
start_run_back(); start_run_back();
} }
// ZLOGI(TAG, "%d",getDetectGPIOState()); // ZLOGI(TAG, "%d",getDetectGPIOState());
zos_delay(1);
zos_delay(3);
} }
} else { } else {
while (!m_detect_thread.getExitFlag()) { while (!m_detect_thread.getExitFlag()) {
@ -180,7 +186,7 @@ class WidthDetector {
} else if (!g_isrunning && getDetectGPIOState() == 0) { } else if (!g_isrunning && getDetectGPIOState() == 0) {
start_run_forward_slow(); 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); } { wait_modules_idle(NULL, __VA_ARGS__, NULL); }
int32_t IntelligentWindingRobotCtrl::device_reset() { 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ÖḴλ // ZÖḴλ
/** /**
* @ * @
@ -980,6 +1007,8 @@ int32_t IntelligentWindingRobotCtrl::setcfg(const char* cfgname, int32_t cfgvalu
int32_t IntelligentWindingRobotCtrl::dumpcfg() { return 0; } int32_t IntelligentWindingRobotCtrl::dumpcfg() { return 0; }
int32_t IntelligentWindingRobotCtrl::start_winding() { // int32_t IntelligentWindingRobotCtrl::start_winding() { //
#if 0 #if 0
m_work_thread.start([this]() { m_work_thread.start([this]() {
try { try {

Loading…
Cancel
Save