ros-bridge icon indicating copy to clipboard operation
ros-bridge copied to clipboard

Getting info and status from all the traffic lights in the map

Open LulaSan opened this issue 2 years ago • 1 comments

Hello everyone,

I want to obtain information - and then control - the traffic lights on the map through a python script. I did not figure out how this script traffic_lights_sensor.py is supposed to work. With CarlaUE4.sh running, I launched ros2 launch carla-ros-bridge carla-ros-bridge.launch.py but nothing about the traffic lights has been published. How can I trigger these two publishers?: https://github.com/carla-simulator/ros-bridge/blob/master/carla_ros_bridge/src/carla_ros_bridge/traffic_lights_sensor.py#L52

self.traffic_lights_info_publisher = node.new_publisher(
            CarlaTrafficLightInfoList,
            self.get_topic_prefix() + "/info",
            qos_profile=QoSProfile(depth=10, durability=DurabilityPolicy.TRANSIENT_LOCAL))
self.traffic_lights_status_publisher = node.new_publisher(
            CarlaTrafficLightStatusList,
            self.get_topic_prefix() + "/status",
            qos_profile=QoSProfile(depth=10, durability=DurabilityPolicy.TRANSIENT_LOCAL))

LulaSan avatar Dec 15 '22 21:12 LulaSan

You simply have to a pseudo.traffic_lights sensor See SpawnObjetcts docu and e.g. that file as example.

berndgassmann avatar Dec 23 '22 11:12 berndgassmann