guardstrikelab / carla_apollo_bridge

This project aims to provide a data and control bridge for the communication between the latest version of Apollo and Carla.
Apache License 2.0
336 stars 98 forks source link

Creating new customized sensor causing 'Segment Fault' #194

Open cfs4819 opened 6 months ago

cfs4819 commented 6 months ago

Describe the bug

After loading carla_apollo_bridge, some camera sensors need to be spawned so I can recorder the simulation.

However, when I spawned the recording camera, and add my own listenning callback function, a Segment Fault was caused in both Carla-Client and Carla-Server.

In what area(s)?

  • [x] /area runtime

  • [ ] /area operator

  • [ ] /area placement

  • [ ] /area docs

  • [ ] /area test-and-release

A fixing suggestion

I tried adding a check before sensor listenning command in carla_bridge/sensor/camera.py, line 220

class RgbCamera(Camera):

    """
    Camera implementation details for rgb camera
    """

    def __init__(self, uid, name, parent, relative_spawn_pose, node, carla_actor, synchronous_mode):
        """
          ...
        """
        super(RgbCamera, self).__init__(uid=uid,
                                        name=name,
                                        parent=parent,
                                        relative_spawn_pose=relative_spawn_pose,
                                        node=node,
                                        carla_actor=carla_actor,
                                        synchronous_mode=synchronous_mode)
        if name in ["front_6mm", "front_12mm"]:
            self.listen()

So the bridge won't grab the customized sensor.listen callaback function, which is the main cause of segment fault.

But this method relies on understading object.json manualy, the files defines sensors belong exclusively to carla_bridge, instead of automatically excluding sensors belonging to carla_bridge.