Carla 0.9.2 ros-bridge automatically dies when I stop my python script
See original GitHub issueRosbridge 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/client.py __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 manual_control.py script it never dies automatically. Is there anything I am missing / doing wrong in my script below??
def main():
actor_list = []
try:
client = carla.Client('localhost', 2000)
client.set_timeout(2.0)
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)
actor_list.append(vehicle)
print('created %s' % vehicle.type_id)
vehicle.set_autopilot(True)
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)
actor_list.append(lidar)
print('created %s' % lidar.type_id)
while True:
time.sleep(10)
except KeyboardInterrupt:
print("Interrupted!")
finally:
print('destroying actors')
for actor in actor_list:
actor.destroy()
print('done.')
if __name__ == '__main__':
try:
main()
except KeyboardInterrupt:
pass
finally:
print('\ndone.')
Issue Analytics
- State:
- Created 5 years ago
- Comments:13 (7 by maintainers)
Top 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 >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
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.
No, I didn’t.