0

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: tpoics from ROS

Everything works fine except for the topic /carla/ego_vehicle/vehicle_control_cmd_manual which gives an error like this enter image description here

Please tell me what I'm doing wrong.

Jerry
  • 53
  • 5

1 Answers1

0

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. e.g. from carla_msgs.msg import CarlaEgoVehicleControl

BTables
  • 4,413
  • 2
  • 11
  • 30
  • I'm using windows so I'm not really sure what or how to install. I've tried `pip install carla` but didn't work – Jerry Jun 21 '22 at 16:04
  • @Jerry pip is really just for Python packages so that’s why it didn’t work. Have you followed these [install instructions?](https://carla.readthedocs.io/projects/ros-bridge/en/latest/ros_installation_ros2/) – BTables Jun 21 '22 at 17:20
  • I think I'm having this problem because I'm reading a rosbag produced by someone else. I don't have carla installed on my cpu. I was wondering if there was a way around. – Jerry Jun 21 '22 at 23:22
  • @Jerry yea, not having it installed is the issue and unfortunately there isn’t a super easy way around. You need the message definition files so rosbag knows how to translate the data into a message. – BTables Jun 21 '22 at 23:25