intersim

Tsinghua-MARS-Lab/InterSim (github.com)icon-default.png?t=N7T8https://github.com/Tsinghua-MARS-Lab/InterSim

下载 NuPlan 数据集,安装 NuPlan 的 API

安装 — nuplan-devkit v0.1 文档icon-default.png?t=N7T8https://nuplan-devkit.readthedocs.io/en/latest/installation.html

nuplan(面向自动驾驶规划的开源数据集)——ubuntu中的安装与配置-CSDN博客

MetaDrive自动驾驶仿真播放nuplan数据集 - 知乎 (zhihu.com)

安装 miniconda

请参阅 Miniconda 官方页面

创建 Conda 环境

我们使用 environment.yml 创建一个新的 Conda 环境。需要c盘有20g空间

conda env create -f environment.yml

E:\培训\InterSim_backup\nuplan-devkit-nuplan-devkit-v1.0路径下

报错1

解决:重装python=3.9

conda install python=3.9

报错2

问题:磁盘空间不足,但没把miniconda安装在c啊?

网上说是/tmp的原因,于是改临时路径:(没起作用)

如果您只是想在特定的命令行会话中更改临时目录的路径,而不是永久更改系统级别的环境变量,您可以使用以下命令set TMP=E:\intersim这将在当前命令行窗口中更改临时目录的路径。但是,请注意,这种更改仅在当前命令行会话中有效,关闭该会话后将恢复为默认的临时目录路径。echo %TMP%查看临时目录的路径

解决:

C:\Users\Administrator\AppData\Local\Temp

执行conda env create -f environment.yml时临时空间存了17G,所以c盘空间不足了。

由此,把temp临时文件存储位置改到其他磁盘:(也可以给c分盘)

C盘清理教程丨更改Temp文件夹储存路径的方法-『白云居』 (baiyunju.cc)

至此彻底解决conda装虚拟环境造成c盘空间不足的情况。

环境创建成功

import nuplan验证成功

指令总结:

创建:conda env create -f environment.yml

更新:conda env update --name nuplan --file environment.yml --prune

激活:conda activate nuplan

关闭:conda deactivate

删除:conda env remove -n nuplan

清理:conda clean --all

intersim部分

在intersim/simulator 文件夹执行 

python setup.py install 

import interactive_sim验证成功

执行python sim.py --max_scenarios 5

报错:ModuleNotFoundError: No module named ‘fcntl’

解决:miniconda3\envs\Lib下新建一个fcntl.py文件

(放在python/python39/Lib下是没用的)

内容:

def fcntl(fd, op, arg=0):
    return 0
 
def ioctl(fd, op, arg=0, mutable_flag=True):
    if mutable_flag:
        return 0
    else:
        return ""
 
def flock(fd, op):
    return
 
def lockf(fd, operation, length=0, start=0, whence=0):
    return

其他报错:

创建虚拟环境报错 循环依赖,ResolutionTooDeep:200000。

解决:将环境分条配置。

(期间update了pip(好像不是重点,因为后来又装回了21.2.4版本的pip)。)

conda create --name nuplan python=3.9 pip=21.2.4 
conda activate nuplan 
conda install nb_conda_kernels 
pip install -r requirements_torch.txt 
pip install -r requirements.txt  

原yml文件:

name: nuplan
dependencies:
  - python=3.9
  - pip=21.2.4
  - nb_conda_kernels
  - pip:
    - -r requirements_torch.txt
    - -r requirements.txt

(之前在requirement.txt里删了tqdm,不知道有啥影响没有。)

如果报错有关SQLAlchemy:

raise sa_exc.ArgumentError(
sqlalchemy.exc.ArgumentError: Type annotation for “Scene.goal_ego_pose” can’t be correctly interpreted for Annotated Declarative Table form. ORM annotations should normally make use of the `Mapped[]` generic type, or other ORM-compatible generic type, as a container for the actual type, which indicates the intent that the attribute is mapped. Class variables that are not intended to be mapped by the ORM should use ClassVar[]. To allow Annotated Declarative to disregard legacy annotations which don’t use Mapped[] to pass, set “allow_unmapped = True” on the class or a superclass this class. (Background on this error at: Error Messages — SQLAlchemy 2.0 Documentation)

就改SQLAlchemy版本

 注意:官方nuplan-devkit提供的依赖包grpcio与SQLAlchemy版本存在缺失,应当分别安装SQLAlchemy-1.43.0版本与SQLAlchemy-1.4.27版本安装包,因此还需运行以下两行代码以确保版本正确,否则后续运行nuplan会出现bug。

pip install grpcio==1.43.0
pip install SQLAlchemy==1.4.27
不过grpcio要求1.48.2以上

nuplan&intersim配好之后:

执行sim.py

报错找不到nuplan module

Traceback (most recent call last):
File “E:\program\InterSim_backup\InterSim-main\simulator\sim.py”, line 194, in <module>
from nuplan.database.nuplan_db_orm.nuplandb_wrapper import NuPlanDBWrapper
ModuleNotFoundError: No module named ‘nuplan’

解决:gpt说,在sim.py中,将 `nuplan` 模块所在的路径添加到 Python 解释器的搜索路径中。添加以下代码:

import sys

sys.path.append('E:/program/InterSim_backup/nuplan-devkit-nuplan-devkit-v1.0')

报错找不到指定路径:

解决:

修改sim.py和DataLoaderNuPlan.py中的三个路径(dataset,maps,mini)

后来发现这个C盘路径是在config.py里指定的,应该只需要修改这一个文件里的路径:

运行sim.py结果:

github上说

python sim.py --max_scenarios 5

此命令将运行一系列涵盖 5 个场景的快速模拟。模拟完成后,InterSim将使用我们的默认指标打印仿真结果。如果未发生错误,命令行会打印"simulation finished!"

sqlalchemy.exc.InvalidRequestError: No listeners found for event <class 'nuplan.database.nuplan_db_orm.category.Category'> / 'load' / <bound method Table._decorate_record of Category(7 entries):

修改runningmode

0:一直在进行2-63场景

1:无可视化界面

2:可以接着进行到2-67场景(设置了最大场景数5),并产生playback文件,但没出现finish

  • 19
    点赞
  • 23
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值