Ubuntu18.04使用carla0.9.5联合仿真搭环境报错

Ubuntu18.04使用工程与carla0.9.5联合仿真报错

1

File "/home/cg/Auto_driving/src/ros-bridge/carla_ros_bridge/src/carla_ros_bridge/client.py", line 18, in <module>from carla_ros_bridge.bridge_with_rosbag import CarlaRosBridgeWithBagFile "/home/cg/Auto_driving/src/ros-bridge/carla_ros_bridge/src/carla_ros_bridge/bridge_with_rosbag.py", line 16, in <module>import rosbagFile "/opt/ros/melodic/lib/python2.7/dist-packages/rosbag/__init__.py", line 33, in <module>from .bag import Bag, Compression, ROSBagException, ROSBagFormatException, ROSBagUnindexedExceptionFile "/opt/ros/melodic/lib/python2.7/dist-packages/rosbag/bag.py", line 53, in <module>from Cryptodome.Cipher import AES
ModuleNotFoundError: No module named 'Cryptodome'

运行

 pip install pycryptodomex -i https://pypi.tuna.tsinghua.edu.cn/simple

2

Traceback (most recent call last):File "/home/cg/Auto_driving/src/ros-bridge/carla_ackermann_control/src/carla_ackermann_control/carla_ackermann_control_node.py", line 527, in <module>main()File "/home/cg/Auto_driving/src/ros-bridge/carla_ackermann_control/src/carla_ackermann_control/carla_ackermann_control_node.py", line 518, in maincontroller = CarlaAckermannControl()File "/home/cg/Auto_driving/src/ros-bridge/carla_ackermann_control/src/carla_ackermann_control/carla_ackermann_control_node.py", line 88, in __init__lambda: rospy.get_rostime().to_sec() - 0.1)
KeyError: 'simple_pid.PID'
Traceback (most recent call last):File "/home/cg/Auto_driving/src/ros-bridge/carla_ego_vehicle/src/carla_ego_vehicle/carla_ego_vehicle.py", line 42, in <module>from agents.navigation.global_route_planner import GlobalRoutePlanner
ModuleNotFoundError: No module named 'agents'

在.bashrc文件中添加

export PYTHONPATH=$PYTHONPATH:/home/cg/carla-0.9.5/PythonAPI/carla/dist/carla-0.9.5-py3.5-linux-x86_64.egg:/home/cg/carla-0.9.5/PythonAPI/carla

注意改成自己的路径

3

ModuleNotFoundError: No module named 'gnupg'
pip install gnupg -i https://pypi.tuna.tsinghua.edu.cn/simple

4

Traceback (most recent call last):File "/home/cg/Auto_driving/src/ros-bridge/carla_ego_vehicle/src/carla_ego_vehicle/carla_ego_vehicle.py", line 360, in mainego_vehicle.run()File "/home/cg/Auto_driving/src/ros-bridge/carla_ego_vehicle/src/carla_ego_vehicle/carla_ego_vehicle.py", line 339, in runself.world = client.get_world()
RuntimeError: rpc::rpc_error during call in function version

因为手动pip安装了其他carla版本,比如carla-0.9.11,pip卸载就可以:

pip uninstall carla

5

Traceback (most recent call last):File "/home/cg/Auto_driving/src/ros-bridge/carla_ackermann_control/src/carla_ackermann_control/carla_ackermann_control_node.py", line 527, in <module>main()File "/home/cg/Auto_driving/src/ros-bridge/carla_ackermann_control/src/carla_ackermann_control/carla_ackermann_control_node.py", line 518, in maincontroller = CarlaAckermannControl()File "/home/cg/Auto_driving/src/ros-bridge/carla_ackermann_control/src/carla_ackermann_control/carla_ackermann_control_node.py", line 88, in __init__lambda: rospy.get_rostime().to_sec() - 0.1)
KeyError: 'simple_pid.PID'

simple_pid版本不对,安装

pip install simple_pid==0.2.4 -i https://pypi.tuna.tsinghua.edu.cn/simple

6

Traceback (most recent call last):
File “/opt/ros/melodic/lib/turtle_tf/turtle_tf_broadcaster.py”, line 37, in
import tf
File “/opt/ros/melodic/lib/python2.7/dist-packages/tf/init.py”, line 30, in
from tf2_ros import TransformException as Exception, ConnectivityException, LookupException, ExtrapolationException
File “/opt/ros/melodic/lib/python2.7/dist-packages/tf2_ros/init.py”, line 38, in
from tf2_py import *
File “/opt/ros/melodic/lib/python2.7/dist-packages/tf2_py/init.py”, line 38, in
from ._tf2 import *
ImportError: dynamic module does not define module export function (PyInit__tf2)9

出现这种问题一般是由于Ros目前只支持Python2,一些主要的功能包如tf2等都是在Python2的环境下运行的,在Python2中导入相关包不会出现问题,但在Python3中会出错。安装:

sudo apt update
sudo apt install python3-catkin-pkg-modules python3-rospkg-modules python3-empy
#准备一个catkin工作空间,因为都叫catkin_ws,我就把它和ros-bridge放同一个目录下了
mkdir -p ~/catkin_ws/src
cd ~/catkin_ws
catkin_make
source devel/setup.bash
wstool init
wstool set -y src/geometry2 --git https://github.com/ros/geometry2 -v 0.6.5
wstool up
rosdep install --from-paths src --ignore-src -y -r
#最后用Python3编译,注意,编译的python环境也得是python3
catkin build --cmake-args \-DCMAKE_BUILD_TYPE=Release \-DPYTHON_EXECUTABLE=/usr/bin/python3 \ -DPYTHON_INCLUDE_DIR=/usr/include/python3.6m \-DPYTHON_LIBRARY=/usr/lib/x86_64-linux-gnu/libpython3.6m.so

7

Traceback (most recent call last):File "/opt/anaconda3/envs/autoware/lib/python3.7/threading.py", line 926, in _bootstrap_innerself.run()File "/opt/anaconda3/envs/autoware/lib/python3.7/threading.py", line 870, in runself._target(*self._args, **self._kwargs)File "/home/cg/ros_carla/src/carla_ros_bridge/src/carla_ros_bridge/bridge.py", line 271, in _synchronous_mode_updateself._update(frame, world_snapshot.timestamp.elapsed_seconds)File "/home/cg/ros_carla/src/carla_ros_bridge/src/carla_ros_bridge/bridge.py", line 312, in _updateself.actor_factory.update_actor_states(frame_id, timestamp)File "/home/cg/ros_carla/src/carla_ros_bridge/src/carla_ros_bridge/actor_factory.py", line 143, in update_actor_statesself.actors[actor_id].update(frame_id, timestamp)File "/home/cg/ros_carla/src/carla_ros_bridge/src/carla_ros_bridge/sensor.py", line 253, in updateself._update_synchronous_sensor(frame, timestamp)File "/home/cg/ros_carla/src/carla_ros_bridge/src/carla_ros_bridge/sensor.py", line 234, in _update_synchronous_sensorself.sensor_data_updated(carla_sensor_data)File "/home/cg/ros_carla/src/carla_ros_bridge/src/carla_ros_bridge/camera.py", line 121, in sensor_data_updatedimg_msg = self.get_ros_image(carla_camera_data)File "/home/cg/ros_carla/src/carla_ros_bridge/src/carla_ros_bridge/camera.py", line 163, in get_ros_imageimg_msg = Camera.cv_bridge.cv2_to_imgmsg(image_data_array, encoding=encoding)File "/opt/ros/melodic/lib/python2.7/dist-packages/cv_bridge/core.py", line 259, in cv2_to_imgmsgif self.cvtype_to_name[self.encoding_to_cvtype2(encoding)] != cv_type:File "/opt/ros/melodic/lib/python2.7/dist-packages/cv_bridge/core.py", line 91, in encoding_to_cvtype2from cv_bridge.boost.cv_bridge_boost import getCvType
ImportError: dynamic module does not define module export function (PyInit_cv_bridge_boost)

参考:https://blog.csdn.net/qq_41035283/article/details/120887112
就是要注意下载的vision_opencv版本要是melodic的。

总结
ubuntu18.04运行carla比较麻烦,因为默认的python是2.7,包括ros自带的也是python2,所以会遇到一些错误,但是不慌,慢慢学习,解决。还有最好使用conda去创建python3环境,良好习惯。

在这里插入图片描述需要购买代码的可以私。

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.hqwc.cn/news/61167.html

如若内容造成侵权/违法违规/事实不符,请联系编程知识网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

实例035 动画形式的程序界面

实例说明 在很多的程序界面中&#xff0c;都是以菜单或工具栏的形式显示窗体界面&#xff0c;这种显示方式是以静止状态显示的&#xff0c;界面不够生动。下面介绍一个以动画显示窗体界面的设计方法。运行本例&#xff0c;效果如图1.35所示。 技术要点 在该实例中用到了Micr…

SketchUp Pro 2023 for Mac(草图大师)

SketchUp Pro 2023 for Mac提供了简单易学的用户界面和强大的工具集&#xff0c;使用户可以快速创建复杂的3D模型。其中包括智能绘图工具、自动生成几何体、高级纹理编辑器、实时阴影、交互式地形建模工具等功能。 一、创建形象化您的想法 手工绘制的乐趣。超级智能的3D建模软…

[足式机器人]Part4 机械设计 Ch00/01 绪论+机器结构组成与连接 ——【课程笔记】

本文仅供学习使用 本文参考&#xff1a; 《机械设计》 王德伦 马雅丽课件与日常作业可登录网址 http://edu.bell-lab.com/manage/#/login&#xff0c;选择观摩登录&#xff0c;查看2023机械设计2。 机械设计-Ch00Ch01——绪论机器结构组成与连接 Ch00-绪论0.1 何为机械设计——…

云渲染:物理机房vs服务器机房,哪个更省时省力?

在3D渲染行业&#xff0c;传统的物理机和新兴的云服务器成为了企业在大规模渲染时面临的难题。物理机房和云服务器机房&#xff0c;究竟哪个渲染起来更省时省力呢&#xff1f;想知道就看下去吧&#xff01; 1.物理机房 物理机是传统的服务器形式&#xff0c;是一种独立的硬件设…

SpringBoot 依赖管理

Spring Boot 依赖管理 在 Spring Boot 中&#xff0c;依赖管理是通过 Maven 或 Gradle 进行管理的。Spring Boot 提供了一种简化的方式来管理和引入依赖项&#xff0c;使得构建和管理项目变得更加容易。下面是一些关于 Spring Boot 依赖管理的基本信息和示例&#xff1a; 使用…

linux remoteproc驱动中elf解析函数实现分析

linux remoteproc驱动中elf解析函数实现分析 1 ELF文件组织结构2 ELF_GEN_FIELD_GET_SET3 elf 各种header解析接口以及其实现3.1 elf header3.1.1 elf header解析接口3.1.2 elf header各个解析函数为&#xff1a;3.1.2.1 ELF_GEN_FIELD_GET_SET(hdr, e_entry, u64)3.1.2.2 ELF_…

LVS集群

目录 1、lvs简介&#xff1a; 2、lvs架构图&#xff1a; 3、 lvs的工作模式&#xff1a; 1&#xff09; VS/NAT&#xff1a; 即&#xff08;Virtual Server via Network Address Translation&#xff09; 2&#xff09;VS/TUN &#xff1a;即&#xff08;Virtual Server v…

LeetCode 热题 100 JavaScript--141. 环形链表

给你一个链表的头节点 head &#xff0c;判断链表中是否有环。 如果链表中有某个节点&#xff0c;可以通过连续跟踪 next 指针再次到达&#xff0c;则链表中存在环。 为了表示给定链表中的环&#xff0c;评测系统内部使用整数 pos 来表示链表尾连接到链表中的位置&#xff08;…

openGauss学习笔记-36 openGauss 高级数据管理-TRUNCATE TABLE语句

文章目录 openGauss学习笔记-36 openGauss 高级数据管理-TRUNCATE TABLE语句36.1 语法格式36.2 参数说明36.3 示例 openGauss学习笔记-36 openGauss 高级数据管理-TRUNCATE TABLE语句 清理表数据&#xff0c;TRUNCATE TABLE用于删除表的数据&#xff0c;但不删除表结构。也可以…

wonderful-sql 作业

Sql 作业 作业1&#xff1a; 答&#xff1a; create table Employee (Id integer not null, Name varchar(32) , Salary integer, departmentId integer, primary key (Id) );create table Department( Id integer primary key, Name varchar(30) not null );insert into emp…

STM32基于CubeIDE和HAL库 基础入门学习笔记:物联网项目开发流程和思路

文章目录&#xff1a; 第一部分&#xff1a;项目开始前的计划与准备 1.项目策划和开发规范 1.1 项目要求文档 1.2 技术实现文档 1.3 开发规范 2.创建项目工程与日志 第二部分&#xff1a;调通硬件电路与驱动程序 第三部分&#xff1a;编写最基础的应用程序 第四部分&…

Docker desktop使用配置

1. 下载安装 https://www.docker.com/ 官网下载并安装doker desktop 2. 配置镜像 &#xff08;1&#xff09;首先去阿里云网站上进行注册&#xff1a;https://cr.console.aliyun.com/cn-hangzhou/instances/mirrors &#xff08;2&#xff09;注册完成后搜索&#xff1a;容…