def get_vehicle_num(self):
        """
        Get the vehicles on road
        :return:
        """
        if self.mode in {TrafficMode.Basic, TrafficMode.Respawn}:
            return len(self._traffic_vehicles)
        return sum(len(block_vehicle_set.vehicles) for block_vehicle_set in self.block_triggered_vehicles)

        Get the vehicles on road
        :return:
        
metadrive/manager/traffic_manager.py