From 4cea109c71901d9f6ab5d6c62f0c52ccb75997a5 Mon Sep 17 00:00:00 2001 From: yangtzech <yangtzech@qq.com> Date: Sat, 15 Mar 2025 20:38:15 +0800 Subject: [PATCH] fix "ModuleNotFoundError: No module named 'utils'" --- .../lqr_speed_steer_control/lqr_speed_steer_control.py | 4 ++-- PathTracking/lqr_steer_control/lqr_steer_control.py | 4 ++-- PathTracking/rear_wheel_feedback/rear_wheel_feedback.py | 7 +++++-- PathTracking/stanley_controller/stanley_controller.py | 4 ++-- 4 files changed, 11 insertions(+), 8 deletions(-) diff --git a/PathTracking/lqr_speed_steer_control/lqr_speed_steer_control.py b/PathTracking/lqr_speed_steer_control/lqr_speed_steer_control.py index d85fa98a840..5831d02d300 100644 --- a/PathTracking/lqr_speed_steer_control/lqr_speed_steer_control.py +++ b/PathTracking/lqr_speed_steer_control/lqr_speed_steer_control.py @@ -11,9 +11,9 @@ import numpy as np import scipy.linalg as la import pathlib -from utils.angle import angle_mod -sys.path.append(str(pathlib.Path(__file__).parent.parent.parent)) +sys.path.append(str(pathlib.Path(__file__).parent.parent.parent)) +from utils.angle import angle_mod from PathPlanning.CubicSpline import cubic_spline_planner # === Parameters ===== diff --git a/PathTracking/lqr_steer_control/lqr_steer_control.py b/PathTracking/lqr_steer_control/lqr_steer_control.py index 461d6e37223..3c066917ff7 100644 --- a/PathTracking/lqr_steer_control/lqr_steer_control.py +++ b/PathTracking/lqr_steer_control/lqr_steer_control.py @@ -11,9 +11,9 @@ import numpy as np import sys import pathlib -from utils.angle import angle_mod -sys.path.append(str(pathlib.Path(__file__).parent.parent.parent)) +sys.path.append(str(pathlib.Path(__file__).parent.parent.parent)) +from utils.angle import angle_mod from PathPlanning.CubicSpline import cubic_spline_planner Kp = 1.0 # speed proportional gain diff --git a/PathTracking/rear_wheel_feedback/rear_wheel_feedback.py b/PathTracking/rear_wheel_feedback/rear_wheel_feedback.py index 1702bd47ddd..fd04fb6d171 100644 --- a/PathTracking/rear_wheel_feedback/rear_wheel_feedback.py +++ b/PathTracking/rear_wheel_feedback/rear_wheel_feedback.py @@ -8,11 +8,14 @@ import matplotlib.pyplot as plt import math import numpy as np -from utils.angle import angle_mod - +import sys +import pathlib from scipy import interpolate from scipy import optimize +sys.path.append(str(pathlib.Path(__file__).parent.parent.parent)) +from utils.angle import angle_mod + Kp = 1.0 # speed proportional gain # steering control parameter KTH = 1.0 diff --git a/PathTracking/stanley_controller/stanley_controller.py b/PathTracking/stanley_controller/stanley_controller.py index 08aa0493952..bc98175f178 100644 --- a/PathTracking/stanley_controller/stanley_controller.py +++ b/PathTracking/stanley_controller/stanley_controller.py @@ -13,9 +13,9 @@ import matplotlib.pyplot as plt import sys import pathlib -from utils.angle import angle_mod -sys.path.append(str(pathlib.Path(__file__).parent.parent.parent)) +sys.path.append(str(pathlib.Path(__file__).parent.parent.parent)) +from utils.angle import angle_mod from PathPlanning.CubicSpline import cubic_spline_planner k = 0.5 # control gain