简体   繁体   中英

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. I'm using this library rosbags to retrieve data.

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 的主题

Everything works fine except for the topic /carla/ego_vehicle/vehicle_control_cmd_manual which gives an error like this在此处输入图像描述

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.

It messages are installed you should be importing them in your Python file, so it has a message description to work off. eg from carla_msgs.msg import CarlaEgoVehicleControl

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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