From 01b9d7f732b16778d648d00434aae74dda0648f0 Mon Sep 17 00:00:00 2001 From: Champagne <1369741103@qq.com> Date: Fri, 20 Jun 2025 15:10:37 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0=20'py/measure=5Flib.py'?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- py/measure_lib.py | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/py/measure_lib.py b/py/measure_lib.py index 038922b..44c6597 100644 --- a/py/measure_lib.py +++ b/py/measure_lib.py @@ -177,19 +177,19 @@ def vs_measurement(txt_name,position): if not os.path.exists(txt_name): return None,None,None,None # 获取数据 - try: - x_bot, y_bot, x_top, y_top = get_data.get_data(txt_name) - x_bot = np.array(x_bot) - y_bot = np.array(y_bot) - x_top = np.array(x_top) - y_top = np.array(y_top) + + x_bot, y_bot, x_top, y_top = get_data.get_data(txt_name) + x_bot = np.array(x_bot) + y_bot = np.array(y_bot) + x_top = np.array(x_top) + y_top = np.array(y_top) + if not x_bot or y_bot or x_top or y_top + return 1,1,1,1 # 拟合路沿上下直线方程 - slope_bot, intercept_bot, r2_bot = calc_slope_line.linear_regression(x_bot, y_bot) - slope_top, intercept_top, r2_top = calc_slope_line.linear_regression(x_top,y_top) - except Exception as e: - print(f"处理过程中发生错误: {e}") - return 1,1,1,1 + slope_bot, intercept_bot, r2_bot = calc_slope_line.linear_regression(x_bot, y_bot) + slope_top, intercept_top, r2_top = calc_slope_line.linear_regression(x_top,y_top) + # 拟合车轮垂线方程 # x_zero_xto0, y_zero_xto0 = calc_way.calc_zeros_xto0() # x_zero_xto0 = np.array(x_zero_xto0)