carla-simulator / carla

Open-source simulator for autonomous driving research.
http://carla.org
MIT License
10.88k stars 3.5k forks source link

There is some problem with the image displayed by rgb camera #6999

Closed Willis814 closed 7 months ago

Willis814 commented 7 months ago

CARLA version:0.9.14 Platform/OS:Windows 11 Problem you have experienced:There is some problem with the image displayed by rgb camera and the terminal prompts that the version is different and there is still no "/PythonAPI/carla/dist" folder after rebuilding PythonAPI. 005973

WARNING: Version mismatch detected: You are trying to connect to a simulator that might be incompatible with this API WARNING: Client API version = 0.9.14 WARNING: Simulator API version = 0.9.14-6-g43b5e7064-dirty

Below is my python code: import carla import numpy as np import time def save_image(image): array = np.frombuffer(image.raw_data, dtype=np.dtype("uint8")) array = np.reshape(array, (image.height, image.width, 4)) array = array[:, :, :3] image.save_to_disk('_out/%06d.png' % image.frame)

client = carla.Client('localhost', 2000) client.set_timeout(10.0) world = client.get_world() blueprint_library = world.get_blueprint_library() vehicle_bp = blueprint_library.filter('vehicle.tesla.model3')[0] spawn_point = carla.Transform(carla.Location(x=0, y=0, z=2), carla.Rotation(yaw=180)) vehicle = world.spawn_actor(vehicle_bp, spawn_point) camera_bp = world.get_blueprint_library().find('sensor.camera.rgb') camera_transform = carla.Transform(carla.Location(x=1.5, z=2.4)) camera = world.spawn_actor(camera_bp, camera_transform, attach_to=vehicle)

camera.listen(lambda image: save_image(image)) time.sleep(1) vehicle.destroy()

should i rebuild carla? It would be better if there are other solutions! And I have never encountered this kind of problem on my Ubuntu system. I would be very grateful if I could get any reply.

mawistc commented 7 months ago

see #6085

Willis814 commented 7 months ago

Thanks!