简体   繁体   English

使用 ROSBAGS 的 Carla 数据提取密钥错误

[英]Carla Data Extraction Key Error with ROSBAGS

I'm pretty new to ROS and Carla, but I'm doing a project on imitation learning that needs to extract data from ROS.我对 ROS 和 Carla 很陌生,但我正在做一个需要从 ROS 中提取数据的模仿学习项目。 I'm using this library rosbags to retrieve data.我正在使用这个库rosbags来检索数据。

With other datas like image and speed, I could easily extract and deserialize with the following code.使用图像和速度等其他数据,我可以使用以下代码轻松提取和反序列化。

from rosbags.rosbag2 import Reader
from rosbags.serde import deserialize_cdr

def print_data(topic):
    with Reader('carla_data') as reader:
        for i, (connection, timestamp, rawdata) in enumerate(reader.messages()):
            if connection.topic == topic:
                msg = deserialize_cdr(rawdata, connection.msgtype)
                print(i, msg)
                break

I have data from topics from ROS for the following:我有来自 ROS 的以下主题的数据: 来自 ROS 的主题

Everything works fine except for the topic /carla/ego_vehicle/vehicle_control_cmd_manual which gives an error like this一切正常,除了主题/carla/ego_vehicle/vehicle_control_cmd_manual给出这样的错误在此处输入图像描述

Please tell me what I'm doing wrong.请告诉我我做错了什么。

Do you have those message files installed on the computer you're running this on?您是否在运行它的计算机上安装了这些消息文件? If not, they need to be installed via apt (or whatever package manager you use.如果没有,则需要通过apt (或您使用的任何包管理器)安装它们。

It messages are installed you should be importing them in your Python file, so it has a message description to work off.它安装了消息,您应该将它们导入您的 Python 文件中,因此它有一个可以处理的消息描述。 eg from carla_msgs.msg import CarlaEgoVehicleControl例如from carla_msgs.msg import CarlaEgoVehicleControl

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM