carla-simulator / ros-bridge

ROS bridge for CARLA Simulator
MIT License
523 stars 430 forks source link

Spawning pedestrian ai controller moves pedestrians to map origin #688

Open etfini opened 1 year ago

etfini commented 1 year ago

I tried spawning pedestrians via a ros node as a client. When I spawn an ai controller and attach it to the pedestrian the pedestrian is moved to the map origin (0,0,0) or very close to it. I think some of it might be an issue with the carla version. When I manually set the carla version for the ros bridge to 9.14, pedestrians are not moved to the map origin. However, the pedestrians remain static even with a controller attached and a destination and speed set. When I spawn in asynchronous mode and attach the controller, the pedestrians stay at their spawn points. As soon as I switch to synchronous mode, the pedestrians are moved to map origin. Am I doing something wrong or is this a bug in the bridge or in carla?

Code snippet of how I spawn pedestrians:

blueprint = random.choice(self.world.get_blueprint_library().filter('walker.pedestrian.*'))
walker_controller_bp = self.world.get_blueprint_library().find('controller.ai.walker')
spawn_point = carla.Transform()
spawn_point.location = self.world.get_random_location_from_navigation()
walker = self.world.try_spawn_actor(blueprint=blueprint, transform=spawn_point)
if walker:
      controller = self.world.try_spawn_actor(blueprint=walker_controller_bp, transform=carla.Transform(), attach_to=self.walker)
      if controller:
           # start ai controller
           self.controller.start()
           loc = self.world.get_random_location_from_navigation()
           self.controller.go_to_location(loc)
           self.controller.set_max_speed(1 + random.random())

Also the camera images seem distorted in RViZ when I manually cange the carla version for the ros bridge. (see attached image for semantic segmentation camera) sematic_seg_9_14