Browse Source

调整hbot零点偏移实现方案

master
zhaohe 3 months ago
parent
commit
03daf2c8ed
  1. 14
      sdk/components/xy_robot_ctrl_module/xy_robot_ctrl_module.cpp
  2. 2
      usrc/version.h

14
sdk/components/xy_robot_ctrl_module/xy_robot_ctrl_module.cpp

@ -232,8 +232,6 @@ int32_t XYRobotCtrlModule::module_set_reg(int32_t regindex, int32_t val) {
MODULE_REG_CASE__NOT_SUPPORT(kreg_xyrobot_has_move_to_zero); MODULE_REG_CASE__NOT_SUPPORT(kreg_xyrobot_has_move_to_zero);
MODULE_REG_CASE__NOT_SUPPORT(kreg_xyrobot_is_enable); MODULE_REG_CASE__NOT_SUPPORT(kreg_xyrobot_is_enable);
default: default:
return err::kmodule_not_find_reg; return err::kmodule_not_find_reg;
break; break;
@ -244,7 +242,6 @@ int32_t XYRobotCtrlModule::module_set_reg(int32_t regindex, int32_t val) {
return ret; return ret;
} }
int32_t XYRobotCtrlModule::module_get_reg(int32_t regindex, int32_t* val) { int32_t XYRobotCtrlModule::module_get_reg(int32_t regindex, int32_t* val) {
int32_t ret = 0; int32_t ret = 0;
switch (regindex) { switch (regindex) {
MODULE_CFG_CASE__GET_REG_FROM(kreg_xyrobot_robot_type, m_cfg.robot_type); MODULE_CFG_CASE__GET_REG_FROM(kreg_xyrobot_robot_type, m_cfg.robot_type);
@ -281,7 +278,6 @@ int32_t XYRobotCtrlModule::module_get_reg(int32_t regindex, int32_t* val) {
MODULE_CFG_CASE__GET_REG_FROM(kreg_xyrobot_has_move_to_zero, m_state.has_move_to_zero); MODULE_CFG_CASE__GET_REG_FROM(kreg_xyrobot_has_move_to_zero, m_state.has_move_to_zero);
MODULE_CFG_CASE__GET_REG_FROM(kreg_xyrobot_is_enable, m_state.is_enable); MODULE_CFG_CASE__GET_REG_FROM(kreg_xyrobot_is_enable, m_state.is_enable);
default: default:
return err::kmodule_not_find_reg; return err::kmodule_not_find_reg;
break; break;
@ -329,7 +325,7 @@ int32_t XYRobotCtrlModule::do_xymotor_move_to_zero() {
int32_t ecode = exec_move_to_zero_task(); int32_t ecode = exec_move_to_zero_task();
after_motor_move(); after_motor_move();
if (ecode == 0) { if (ecode == 0) {
setnowpos(0, 0);
setnowpos(0 + m_cfg.shift_x, 0 + m_cfg.shift_y);
m_state.has_move_to_zero = 1; m_state.has_move_to_zero = 1;
} }
return; return;
@ -451,12 +447,12 @@ void XYRobotCtrlModule::inverse_kinematics(int32_t m1pos, int32_t m2pos, int32_t
if (m_cfg.x_shaft) x = -x; if (m_cfg.x_shaft) x = -x;
if (m_cfg.y_shaft) y = -y; if (m_cfg.y_shaft) y = -y;
x += m_cfg.shift_x;
y += m_cfg.shift_y;
// x += m_cfg.shift_x;
// y += m_cfg.shift_y;
} }
void XYRobotCtrlModule::forward_kinematics(int32_t x, int32_t y, int32_t& m1pos, int32_t& m2pos) { void XYRobotCtrlModule::forward_kinematics(int32_t x, int32_t y, int32_t& m1pos, int32_t& m2pos) {
x -= m_cfg.shift_x;
y -= m_cfg.shift_y;
// x -= m_cfg.shift_x;
// y -= m_cfg.shift_y;
if (m_cfg.x_shaft) x = -x; if (m_cfg.x_shaft) x = -x;
if (m_cfg.y_shaft) y = -y; if (m_cfg.y_shaft) y = -y;

2
usrc/version.h

@ -1,2 +1,2 @@
#pragma once #pragma once
#define APP_VERSION 1201
#define APP_VERSION 1202
Loading…
Cancel
Save