Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Carla 0.9.2 ros-bridge automatically dies when I stop my python script

See original GitHub issue

Rosbridge dies with different errors every time I stop [ctrl + c] my python script. A similar thing happens with the scenario_runner package when a scenario finishes. Not sure if it is the desired behaviour ??

terminate called after throwing an instance of 'std::bad_weak_ptr'
  what():  bad_weak_ptr
[carla_ros_bridge-1] process has died [pid 12253, exit code -6, cmd /home/anshul/catkin_ws/src/carla_ros-bridge/src/carla_ros_bridge/ __name:=carla_ros_bridge __log:=/home/anshul/.ros/log/0a3dc748-1265-11e9-ae1d-18a905c1f8b8/carla_ros_bridge-1.log].
log file: /home/anshul/.ros/log/0a3dc748-1265-11e9-ae1d-18a905c1f8b8/carla_ros_bridge-1*.log

And then there are few times it doesn’t dies automaically. Not sure what is the reason for this. I also observed that while closing script it never dies automatically. Is there anything I am missing / doing wrong in my script below??

def main():
    actor_list = []
        client = carla.Client('localhost', 2000)
        world = client.get_world()
        spectator = world.get_spectator()
        blueprint_library = world.get_blueprint_library()

        bp = random.choice(blueprint_library.filter('vehicle'))
        bp.set_attribute('role_name', 'hero')
        color = random.choice(bp.get_attribute('color').recommended_values)
        bp.set_attribute('color', color)
        transform = random.choice(world.get_map().get_spawn_points())
        vehicle = world.spawn_actor(bp, transform)
        print('created %s' % vehicle.type_id)

        lidar_bp = blueprint_library.find('sensor.lidar.ray_cast')
        lidar_bp.set_attribute('rotation_frequency', '10')
        lidar_bp.set_attribute('channels', '16')
        lidar_bp.set_attribute('range', '5000')
        lidar_bp.set_attribute('points_per_second', '222000')
        lidar_transform = carla.Transform(carla.Location(x= 0,z=2.4))
        lidar = world.spawn_actor(lidar_bp, lidar_transform, attach_to=vehicle)
        print('created %s' % lidar.type_id)

        while True:

    except KeyboardInterrupt:


        print('destroying actors')
        for actor in actor_list:

if __name__ == '__main__':

    except KeyboardInterrupt:

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:13 (7 by maintainers)

github_iconTop GitHub Comments

fabianoborilcommented, Jan 14, 2019

Well, maybe take a look into the logfiles that ros creates for each node and see if there is a good pointer to start with.

kargarisaaccommented, Nov 27, 2020

@kargarisaac Hi, Were you able to fix it or find a walk around?

No, I didn’t.

Read more comments on GitHub >

github_iconTop Results From Across the Web

F.A.Q. - CARLA Simulator
Cloning the Unreal Engine repository shows an error. AttributeError: module 'carla' has no attribute 'Client' when running a script. Cannot run example scripts ......
Read more >
Self-driving cars with Carla and Python p.2 - YouTube
Welcome to part 2 of the Carla self-driving car tutorial series. In this tutorial, we're going to introduce you to the Python API...
Read more >
carla-ros-bridge error due to Python? - ROS Answers
Also, it's not saving the log file so that's why i didnt attach that Installation was done following the instructions on gitlab!
Read more >
How to use the carla.Client function in carla - Snyk
To help you get started, we've selected a few carla examples, based on popular ways it is used in public projects. Secure your...
Read more >
Introduction - Self-driving cars with Carla and Python part 1
With Carla, we get a car (obviously), an environment to drive that car in, and then we have a bunch of sensors that...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Post

No results found

github_iconTop Related Hashnode Post

No results found