问题描述
我正在尝试从作为主类的ModuleLMPC
初始化一个类commander.py
。我收到以下错误消息。
File "D:\CARLA\PythonAPI\examples\fnc\commander.py",line 89,in __init__
self.LMPC = ModuleLMPC(self.dt,self.LapTime,self.maxLaps,self.Map)
TypeError: 'module' object is not callable
我将ModuleLMPC
导入为:
from ModuleLMPC import ModuleLMPC
我正在尝试从ModuleLMPC
文件中导入ModuleLMPC.py
。它们具有相同的名称。
ModuleLMPC
前几行如下:
from SysModel import Simulator,PID
from Classes import ClosedLoopData,LMPCprediction
from PathFollowingLTVMPC import PathFollowingLTV_MPC
from PathFollowingLTIMPC import PathFollowingLTI_MPC
from LMPC import ControllerLMPC
from Utilities import Regression
import numpy as np
import pdb
import pickle
class ModuleLMPC(object):
def __init(self,dt,Time,maxlaps,map):
# ======================================================================================================================
# ============================ Choose which controller to run ==========================================================
# ======================================================================================================================
self.RunPID = 1
self.RunMPC = 1
然后将ModuleLMPC
中的commander.py
初始化为:
self.LMPC = ModuleLMPC(self.dt,self.Map)
我什至将所有内容都移到了同一文件夹中。不确定错误的含义。
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)